/* Licensed to the Apache Software Foundation (ASF) under one or more
 * contributor license agreements.  See the NOTICE file distributed with
 * this work for additional information regarding copyright ownership.
 * The ASF licenses this file to You under the Apache License, Version 2.0
 * (the "License"); you may not use this file except in compliance with
 * the License.  You may obtain a copy of the License at
 *
 *     http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */

#include "zobjects_gtk.h"

ZlangInvokeFunction ZlangInvokeFunction_guiwindow_SetTitle_string;
int ZlangInvokeFunction_guiwindow_SetTitle_string( struct ZlangRuntime *rt , struct ZlangObject *obj )
{
	struct ZlangDirectProperty_guiwindow		*guiwindow_direct_prop = GetObjectDirectProperty(obj) ;
	struct ZlangDirectProperty_guiwidget_common	*guiwindow_common = (struct ZlangDirectProperty_guiwidget_common *)guiwindow_direct_prop ;
	struct ZlangObject				*in1 = GetInputParameterInLocalObjectStack(rt,1) ;
	struct ZlangObject				*out1 = GetOutputParameterInLocalObjectStack(rt,1) ;
	char						*str = NULL ;
	
	CallRuntimeFunction_string_GetStringValue( rt , in1 , & str , NULL );
	gtk_window_set_title( GTK_WINDOW(guiwindow_common->gtk_widget) , str ) ;

	TRANSFER_MASTER_OBJECT_TO_OUTPUT_OBJECT

	return 0;
}

ZlangInvokeFunction ZlangInvokeFunction_guiwindow_GetTitle;
int ZlangInvokeFunction_guiwindow_GetTitle( struct ZlangRuntime *rt , struct ZlangObject *obj )
{
	struct ZlangDirectProperty_guiwindow		*guiwindow_direct_prop = GetObjectDirectProperty(obj) ;
	struct ZlangDirectProperty_guiwidget_common	*guiwindow_common = (struct ZlangDirectProperty_guiwidget_common *)guiwindow_direct_prop ;
	struct ZlangObject				*out1 = GetOutputParameterInLocalObjectStack(rt,1) ;
	const char					*str = NULL ;
	
	str = gtk_window_get_title( GTK_WINDOW(guiwindow_common->gtk_widget) ) ;

	CallRuntimeFunction_string_SetStringValue( rt , out1 , (char*)str , STRLEN_OF_STRING );

	return 0;
}

ZlangInvokeFunction ZlangInvokeFunction_guiwindow_SetDefaultSize_int_int;
int ZlangInvokeFunction_guiwindow_SetDefaultSize_int_int( struct ZlangRuntime *rt , struct ZlangObject *obj )
{
	struct ZlangDirectProperty_guiwindow		*guiwindow_direct_prop = GetObjectDirectProperty(obj) ;
	struct ZlangDirectProperty_guiwidget_common	*guiwindow_common = (struct ZlangDirectProperty_guiwidget_common *)guiwindow_direct_prop ;
	struct ZlangObject				*in1 = GetInputParameterInLocalObjectStack(rt,1) ;
	struct ZlangObject				*in2 = GetInputParameterInLocalObjectStack(rt,2) ;
	struct ZlangObject				*out1 = GetOutputParameterInLocalObjectStack(rt,1) ;
	int32_t						width ;
	int32_t						height ;
	
	CallRuntimeFunction_int_GetIntValue( rt , in1 , & width );
	CallRuntimeFunction_int_GetIntValue( rt , in2 , & height );
	/*
	if( width == -1 || height == -1 )
	{
		GdkDisplay *display = gdk_display_get_default() ;
		if( display == NULL )
			return ThrowErrorException( rt , EXCEPTION_CODE_GENERAL , EXCEPTION_MESSAGE_GDK_DISPLAY_GET_DEFAULT_FAILED );

		GdkMonitor *monitor = gdk_display_get_primary_monitor( display );
		if( monitor == NULL )
			return ThrowErrorException( rt , EXCEPTION_CODE_GENERAL , EXCEPTION_MESSAGE_GDK_DISPLAY_GET_PRIMARY_MONITOR_FAILED );

		GdkRectangle geometry;
		gdk_monitor_get_geometry( monitor , & geometry );

		GdkDisplay *display = gdk_display_get_default();
		GdkRectangle workarea;
		gdk_display_get_monitor_workarea(display, 0, & workarea );
		if( width == -1 )
			width = gdk_screen_get_width(screen) ;
		if( height == -1 )
			width = gdk_screen_get_height(screen) ;
	}
	*/
	gtk_window_set_default_size( GTK_WINDOW(guiwindow_common->gtk_widget) , width , height ) ;

	TRANSFER_MASTER_OBJECT_TO_OUTPUT_OBJECT

	return 0;
}

#if 0
ZlangInvokeFunction ZlangInvokeFunction_guiwindow_SetFullscreen_bool;
int ZlangInvokeFunction_guiwindow_SetFullscreen_bool( struct ZlangRuntime *rt , struct ZlangObject *obj )
{
	struct ZlangDirectProperty_guiwindow		*guiwindow_direct_prop = GetObjectDirectProperty(obj) ;
	struct ZlangDirectProperty_guiwidget_common	*guiwindow_common = (struct ZlangDirectProperty_guiwidget_common *)guiwindow_direct_prop ;
	struct ZlangObject				*in1 = GetInputParameterInLocalObjectStack(rt,1) ;
	struct ZlangObject				*out1 = GetOutputParameterInLocalObjectStack(rt,1) ;
	unsigned char					b ;
	
	CallRuntimeFunction_bool_GetBoolValue( rt , in1 , & b );

	if( b == TRUE )
		gtk_window_fullscreen( GTK_WINDOW(guiwindow_common->gtk_widget) ) ;
	else
		gtk_window_unfullscreen( GTK_WINDOW(guiwindow_common->gtk_widget) ) ;

	TRANSFER_MASTER_OBJECT_TO_OUTPUT_OBJECT

	return 0;
}
#endif

ZlangInvokeFunction ZlangInvokeFunction_guiwindow_Maximize;
int ZlangInvokeFunction_guiwindow_Maximize( struct ZlangRuntime *rt , struct ZlangObject *obj )
{
	struct ZlangDirectProperty_guiwindow		*guiwindow_direct_prop = GetObjectDirectProperty(obj) ;
	struct ZlangDirectProperty_guiwidget_common	*guiwindow_common = (struct ZlangDirectProperty_guiwidget_common *)guiwindow_direct_prop ;
	struct ZlangObject				*out1 = GetOutputParameterInLocalObjectStack(rt,1) ;
	
	gtk_window_maximize( GTK_WINDOW(guiwindow_common->gtk_widget) ) ;

	TRANSFER_MASTER_OBJECT_TO_OUTPUT_OBJECT

	return 0;
}

ZlangInvokeFunction ZlangInvokeFunction_guiwindow_Unmaximize;
int ZlangInvokeFunction_guiwindow_Unmaximize( struct ZlangRuntime *rt , struct ZlangObject *obj )
{
	struct ZlangDirectProperty_guiwindow		*guiwindow_direct_prop = GetObjectDirectProperty(obj) ;
	struct ZlangDirectProperty_guiwidget_common	*guiwindow_common = (struct ZlangDirectProperty_guiwidget_common *)guiwindow_direct_prop ;
	struct ZlangObject				*out1 = GetOutputParameterInLocalObjectStack(rt,1) ;
	
	gtk_window_unmaximize( GTK_WINDOW(guiwindow_common->gtk_widget) ) ;

	TRANSFER_MASTER_OBJECT_TO_OUTPUT_OBJECT

	return 0;
}

ZlangInvokeFunction ZlangInvokeFunction_guiwindow_Minimize;
int ZlangInvokeFunction_guiwindow_Minimize( struct ZlangRuntime *rt , struct ZlangObject *obj )
{
	struct ZlangDirectProperty_guiwindow		*guiwindow_direct_prop = GetObjectDirectProperty(obj) ;
	struct ZlangDirectProperty_guiwidget_common	*guiwindow_common = (struct ZlangDirectProperty_guiwidget_common *)guiwindow_direct_prop ;
	struct ZlangObject				*out1 = GetOutputParameterInLocalObjectStack(rt,1) ;
	
	gtk_window_minimize( GTK_WINDOW(guiwindow_common->gtk_widget) ) ;

	TRANSFER_MASTER_OBJECT_TO_OUTPUT_OBJECT

	return 0;
}

ZlangInvokeFunction ZlangInvokeFunction_guiwindow_Unminimize;
int ZlangInvokeFunction_guiwindow_Unminimize( struct ZlangRuntime *rt , struct ZlangObject *obj )
{
	struct ZlangDirectProperty_guiwindow		*guiwindow_direct_prop = GetObjectDirectProperty(obj) ;
	struct ZlangDirectProperty_guiwidget_common	*guiwindow_common = (struct ZlangDirectProperty_guiwidget_common *)guiwindow_direct_prop ;
	struct ZlangObject				*out1 = GetOutputParameterInLocalObjectStack(rt,1) ;
	
	gtk_window_unminimize( GTK_WINDOW(guiwindow_common->gtk_widget) ) ;

	TRANSFER_MASTER_OBJECT_TO_OUTPUT_OBJECT

	return 0;
}

ZlangInvokeFunction ZlangInvokeFunction_guiwindow_Fullscreen;
int ZlangInvokeFunction_guiwindow_Fullscreen( struct ZlangRuntime *rt , struct ZlangObject *obj )
{
	struct ZlangDirectProperty_guiwindow		*guiwindow_direct_prop = GetObjectDirectProperty(obj) ;
	struct ZlangDirectProperty_guiwidget_common	*guiwindow_common = (struct ZlangDirectProperty_guiwidget_common *)guiwindow_direct_prop ;
	struct ZlangObject				*out1 = GetOutputParameterInLocalObjectStack(rt,1) ;
	
	if( guiwindow_direct_prop->window_type == GUIWINDOWTYPE_DIALOG )
	{
		;
	}
	else if( guiwindow_direct_prop->window_type == GUIWINDOWTYPE_SINGLE_DOCUMENT )
	{
		if( guiwindow_direct_prop->window_type_data.single_doc_win_layouts.guimenubar_obj )
		{
			struct ZlangDirectProperty_guimenubar *guimenubar_direct_prop = GetObjectDirectProperty( guiwindow_direct_prop->window_type_data.single_doc_win_layouts.guimenubar_obj ) ;
			gtk_widget_set_visible( guimenubar_direct_prop->common.gtk_widget , FALSE );
		}

		if( guiwindow_direct_prop->window_type_data.single_doc_win_layouts.guitoolbar_obj )
		{
			struct ZlangDirectProperty_guitoolbar *guitoolbar_direct_prop = GetObjectDirectProperty( guiwindow_direct_prop->window_type_data.single_doc_win_layouts.guitoolbar_obj ) ;
			gtk_widget_set_visible( guitoolbar_direct_prop->common.gtk_widget , FALSE );
		}

		if( guiwindow_direct_prop->window_type_data.single_doc_win_layouts.guistatusbar_obj )
		{
			struct ZlangDirectProperty_guiboxlayout *guistatusbar_direct_prop = GetObjectDirectProperty( guiwindow_direct_prop->window_type_data.single_doc_win_layouts.guistatusbar_obj ) ;
			gtk_widget_set_visible( guistatusbar_direct_prop->common.gtk_widget , FALSE );
		}
	}
	else if( guiwindow_direct_prop->window_type == GUIWINDOWTYPE_MULTIPLE_DOCUMENT )
	{
		if( guiwindow_direct_prop->window_type_data.single_doc_win_layouts.guimenubar_obj )
		{
			struct ZlangDirectProperty_guimenubar *guimenubar_direct_prop = GetObjectDirectProperty( guiwindow_direct_prop->window_type_data.single_doc_win_layouts.guimenubar_obj ) ;
			gtk_widget_set_visible( guimenubar_direct_prop->common.gtk_widget , FALSE );
		}

		if( guiwindow_direct_prop->window_type_data.single_doc_win_layouts.guitoolbar_obj )
		{
			struct ZlangDirectProperty_guitoolbar *guitoolbar_direct_prop = GetObjectDirectProperty( guiwindow_direct_prop->window_type_data.single_doc_win_layouts.guitoolbar_obj ) ;
			gtk_widget_set_visible( guitoolbar_direct_prop->common.gtk_widget , FALSE );
		}

		if( guiwindow_direct_prop->window_type_data.single_doc_win_layouts.guistatusbar_obj )
		{
			struct ZlangDirectProperty_guiboxlayout *guistatusbar_direct_prop = GetObjectDirectProperty( guiwindow_direct_prop->window_type_data.single_doc_win_layouts.guistatusbar_obj ) ;
			gtk_widget_set_visible( guistatusbar_direct_prop->common.gtk_widget , FALSE );
		}
	}
	else
	{
		return ThrowErrorException( rt , ZLANG_ERROR_INVOKE_METHOD_RETURN , EXCEPTION_MESSAGE_WINDOW_TYPE_INVALID );
	}

	gtk_window_fullscreen( GTK_WINDOW(guiwindow_common->gtk_widget) ) ;

	TRANSFER_MASTER_OBJECT_TO_OUTPUT_OBJECT

	return 0;
}

ZlangInvokeFunction ZlangInvokeFunction_guiwindow_Unfullscreen;
int ZlangInvokeFunction_guiwindow_Unfullscreen( struct ZlangRuntime *rt , struct ZlangObject *obj )
{
	struct ZlangDirectProperty_guiwindow		*guiwindow_direct_prop = GetObjectDirectProperty(obj) ;
	struct ZlangDirectProperty_guiwidget_common	*guiwindow_common = (struct ZlangDirectProperty_guiwidget_common *)guiwindow_direct_prop ;
	struct ZlangObject				*out1 = GetOutputParameterInLocalObjectStack(rt,1) ;
	
	if( guiwindow_direct_prop->window_type == GUIWINDOWTYPE_DIALOG )
	{
		;
	}
	else if( guiwindow_direct_prop->window_type == GUIWINDOWTYPE_SINGLE_DOCUMENT )
	{
		if( guiwindow_direct_prop->window_type_data.single_doc_win_layouts.guimenubar_obj )
		{
			struct ZlangDirectProperty_guimenubar *guimenubar_direct_prop = GetObjectDirectProperty( guiwindow_direct_prop->window_type_data.single_doc_win_layouts.guimenubar_obj ) ;
			gtk_widget_set_visible( guimenubar_direct_prop->common.gtk_widget , TRUE );
		}

		if( guiwindow_direct_prop->window_type_data.single_doc_win_layouts.guitoolbar_obj )
		{
			struct ZlangDirectProperty_guitoolbar *guitoolbar_direct_prop = GetObjectDirectProperty( guiwindow_direct_prop->window_type_data.single_doc_win_layouts.guitoolbar_obj ) ;
			gtk_widget_set_visible( guitoolbar_direct_prop->common.gtk_widget , TRUE );
		}

		if( guiwindow_direct_prop->window_type_data.single_doc_win_layouts.guistatusbar_obj )
		{
			struct ZlangDirectProperty_guiboxlayout *guistatusbar_direct_prop = GetObjectDirectProperty( guiwindow_direct_prop->window_type_data.single_doc_win_layouts.guistatusbar_obj ) ;
			gtk_widget_set_visible( guistatusbar_direct_prop->common.gtk_widget , TRUE );
		}
	}
	else if( guiwindow_direct_prop->window_type == GUIWINDOWTYPE_MULTIPLE_DOCUMENT )
	{
		if( guiwindow_direct_prop->window_type_data.single_doc_win_layouts.guimenubar_obj )
		{
			struct ZlangDirectProperty_guimenubar *guimenubar_direct_prop = GetObjectDirectProperty( guiwindow_direct_prop->window_type_data.single_doc_win_layouts.guimenubar_obj ) ;
			gtk_widget_set_visible( guimenubar_direct_prop->common.gtk_widget , TRUE );
		}

		if( guiwindow_direct_prop->window_type_data.single_doc_win_layouts.guitoolbar_obj )
		{
			struct ZlangDirectProperty_guitoolbar *guitoolbar_direct_prop = GetObjectDirectProperty( guiwindow_direct_prop->window_type_data.single_doc_win_layouts.guitoolbar_obj ) ;
			gtk_widget_set_visible( guitoolbar_direct_prop->common.gtk_widget , TRUE );
		}

		if( guiwindow_direct_prop->window_type_data.single_doc_win_layouts.guistatusbar_obj )
		{
			struct ZlangDirectProperty_guiboxlayout *guistatusbar_direct_prop = GetObjectDirectProperty( guiwindow_direct_prop->window_type_data.single_doc_win_layouts.guistatusbar_obj ) ;
			gtk_widget_set_visible( guistatusbar_direct_prop->common.gtk_widget , TRUE );
		}
	}
	else
	{
		return ThrowErrorException( rt , ZLANG_ERROR_INVOKE_METHOD_RETURN , EXCEPTION_MESSAGE_WINDOW_TYPE_INVALID );
	}

	gtk_window_unfullscreen( GTK_WINDOW(guiwindow_common->gtk_widget) ) ;

	TRANSFER_MASTER_OBJECT_TO_OUTPUT_OBJECT

	return 0;
}

ZlangInvokeFunction ZlangInvokeFunction_guiwindow_SetResizable_bool;
int ZlangInvokeFunction_guiwindow_SetResizable_bool( struct ZlangRuntime *rt , struct ZlangObject *obj )
{
	struct ZlangDirectProperty_guiwindow		*guiwindow_direct_prop = GetObjectDirectProperty(obj) ;
	struct ZlangDirectProperty_guiwidget_common	*guiwindow_common = (struct ZlangDirectProperty_guiwidget_common *)guiwindow_direct_prop ;
	struct ZlangObject				*in1 = GetInputParameterInLocalObjectStack(rt,1) ;
	struct ZlangObject				*out1 = GetOutputParameterInLocalObjectStack(rt,1) ;
	unsigned char					b ;
	
	CallRuntimeFunction_bool_GetBoolValue( rt , in1 , & b );

	gtk_window_set_resizable( GTK_WINDOW(guiwindow_common->gtk_widget) , b ) ;

	TRANSFER_MASTER_OBJECT_TO_OUTPUT_OBJECT

	return 0;
}

ZlangInvokeFunction ZlangInvokeFunction_guiwindow_SetDeletable_bool;
int ZlangInvokeFunction_guiwindow_SetDeletable_bool( struct ZlangRuntime *rt , struct ZlangObject *obj )
{
	struct ZlangDirectProperty_guiwindow		*guiwindow_direct_prop = GetObjectDirectProperty(obj) ;
	struct ZlangDirectProperty_guiwidget_common	*guiwindow_common = (struct ZlangDirectProperty_guiwidget_common *)guiwindow_direct_prop ;
	struct ZlangObject				*in1 = GetInputParameterInLocalObjectStack(rt,1) ;
	struct ZlangObject				*out1 = GetOutputParameterInLocalObjectStack(rt,1) ;
	unsigned char					b ;
	
	CallRuntimeFunction_bool_GetBoolValue( rt , in1 , & b );

	gtk_window_set_deletable( GTK_WINDOW(guiwindow_common->gtk_widget) , b ) ;

	TRANSFER_MASTER_OBJECT_TO_OUTPUT_OBJECT

	return 0;
}

ZlangInvokeFunction ZlangInvokeFunction_guiwindow_ShowTitlebarButtons_bool;
int ZlangInvokeFunction_guiwindow_ShowTitlebarButtons_bool( struct ZlangRuntime *rt , struct ZlangObject *obj )
{
	struct ZlangDirectProperty_guiwindow		*guiwindow_direct_prop = GetObjectDirectProperty(obj) ;
	struct ZlangDirectProperty_guiwidget_common	*guiwindow_common = (struct ZlangDirectProperty_guiwidget_common *)guiwindow_direct_prop ;
	struct ZlangObject				*in1 = GetInputParameterInLocalObjectStack(rt,1) ;
	struct ZlangObject				*out1 = GetOutputParameterInLocalObjectStack(rt,1) ;
	unsigned char					b ;
	GtkWidget					*header_bar = NULL ;
	
	CallRuntimeFunction_bool_GetBoolValue( rt , in1 , & b );

	header_bar = gtk_header_bar_new() ;
	gtk_header_bar_set_show_title_buttons( GTK_HEADER_BAR(header_bar) , b );
	gtk_window_set_titlebar( GTK_WINDOW(guiwindow_common->gtk_widget) , header_bar );

	TRANSFER_MASTER_OBJECT_TO_OUTPUT_OBJECT

	return 0;
}

ZlangInvokeFunction ZlangInvokeFunction_guiwindow_SetTransientFor_guiwindow;
int ZlangInvokeFunction_guiwindow_SetTransientFor_guiwindow( struct ZlangRuntime *rt , struct ZlangObject *obj )
{
	struct ZlangDirectProperty_guiwindow		*guiwindow_direct_prop = GetObjectDirectProperty(obj) ;
	struct ZlangDirectProperty_guiwidget_common	*guiwindow_common = (struct ZlangDirectProperty_guiwidget_common *)guiwindow_direct_prop ;
	struct ZlangObject				*in1 = GetInputParameterInLocalObjectStack(rt,1) ;
	struct ZlangObject				*out1 = GetOutputParameterInLocalObjectStack(rt,1) ;
	struct ZlangDirectProperty_guiwindow		*guiparentwindow_direct_prop = GetObjectDirectProperty(in1) ;
	struct ZlangDirectProperty_guiwidget_common	*guiparentwindow_common = (struct ZlangDirectProperty_guiwidget_common *)guiparentwindow_direct_prop ;
	
	gtk_window_set_transient_for( GTK_WINDOW(guiwindow_common->gtk_widget) , GTK_WINDOW(guiparentwindow_common->gtk_widget) );

	TRANSFER_MASTER_OBJECT_TO_OUTPUT_OBJECT

	return 0;
}

ZlangInvokeFunction ZlangInvokeFunction_guiwindow_SetModal_bool;
int ZlangInvokeFunction_guiwindow_SetModal_bool( struct ZlangRuntime *rt , struct ZlangObject *obj )
{
	struct ZlangDirectProperty_guiwindow		*guiwindow_direct_prop = GetObjectDirectProperty(obj) ;
	struct ZlangDirectProperty_guiwidget_common	*guiwindow_common = (struct ZlangDirectProperty_guiwidget_common *)guiwindow_direct_prop ;
	struct ZlangObject				*in1 = GetInputParameterInLocalObjectStack(rt,1) ;
	struct ZlangObject				*out1 = GetOutputParameterInLocalObjectStack(rt,1) ;
	unsigned char					modal ;
	
	CallRuntimeFunction_bool_GetBoolValue( rt , in1 , & modal );

	gtk_window_set_modal( GTK_WINDOW(guiwindow_common->gtk_widget) , modal );

	TRANSFER_MASTER_OBJECT_TO_OUTPUT_OBJECT

	return 0;
}

ZlangInvokeFunction ZlangInvokeFunction_guiwindow_SetControlDefaultMargin_int;
int ZlangInvokeFunction_guiwindow_SetControlDefaultMargin_int( struct ZlangRuntime *rt , struct ZlangObject *obj )
{
	struct ZlangDirectProperty_guiwindow		*guiwindow_direct_prop = GetObjectDirectProperty(obj) ;
	struct ZlangObject				*in1 = GetInputParameterInLocalObjectStack(rt,1) ;
	struct ZlangObject				*out1 = GetOutputParameterInLocalObjectStack(rt,1) ;
	int32_t						margin ;
	
	CallRuntimeFunction_int_GetIntValue( rt , in1 , & margin );

	guiwindow_direct_prop->global_style.ctl_default_margin = margin ;

	TRANSFER_MASTER_OBJECT_TO_OUTPUT_OBJECT

	return 0;
}

ZlangInvokeFunction ZlangInvokeFunction_guiwindow_SetInteractiveDebugging_bool;
int ZlangInvokeFunction_guiwindow_SetInteractiveDebugging_bool( struct ZlangRuntime *rt , struct ZlangObject *obj )
{
	struct ZlangObject				*in1 = GetInputParameterInLocalObjectStack(rt,1) ;
	struct ZlangObject				*out1 = GetOutputParameterInLocalObjectStack(rt,1) ;
	unsigned char					b ;
	
	CallRuntimeFunction_bool_GetBoolValue( rt , in1 , & b );

	gtk_window_set_interactive_debugging( b ) ;

	TRANSFER_MASTER_OBJECT_TO_OUTPUT_OBJECT

	return 0;
}

ZlangInvokeFunction ZlangInvokeFunction_guiwindow_SetChild_object;
int ZlangInvokeFunction_guiwindow_SetChild_object( struct ZlangRuntime *rt , struct ZlangObject *obj )
{
	struct ZlangDirectProperty_guiwindow		*guiwindow_direct_prop = GetObjectDirectProperty(obj) ;
	struct ZlangDirectProperty_guiwidget_common	*guiwindow_common = (struct ZlangDirectProperty_guiwidget_common *)guiwindow_direct_prop ;
	struct ZlangObject				*in1 = GetInputParameterInLocalObjectStack(rt,1) ;
	struct ZlangObject				*out1 = GetOutputParameterInLocalObjectStack(rt,1) ;
	struct ZlangDirectProperty_guiframelayout	*guiwidget_direct_prop = GetObjectDirectProperty(in1) ;
	struct ZlangDirectProperty_guiwidget_common	*guiwidget_common = (struct ZlangDirectProperty_guiwidget_common *)guiwidget_direct_prop ;
	
	if( guiwindow_direct_prop->window_type == GUIWINDOWTYPE_CUSTOM )
	{
		gtk_window_set_child( GTK_WINDOW(guiwindow_common->gtk_widget) , guiwidget_common->gtk_widget );
	}
	else if( guiwindow_direct_prop->window_type == GUIWINDOWTYPE_DIALOG )
	{
		gtk_box_append( GTK_BOX(guiwindow_direct_prop->window_type_data.dlg_win_layouts.guiboxlayout_common.gtk_widget) , guiwidget_common->gtk_widget );
	}
	else if( guiwindow_direct_prop->window_type == GUIWINDOWTYPE_SINGLE_DOCUMENT )
	{

	}
	else if( guiwindow_direct_prop->window_type == GUIWINDOWTYPE_MULTIPLE_DOCUMENT )
	{

	}
	else
	{
		UnreferObject( rt , out1 );
		return ThrowErrorException( rt , ZLANG_ERROR_INVOKE_METHOD_RETURN , EXCEPTION_MESSAGE_WINDOW_TYPE_INVALID );
	}

	return 0;
}

ZlangInvokeFunction ZlangInvokeFunction_guiwindow_SetWindowType_int;
int ZlangInvokeFunction_guiwindow_SetWindowType_int( struct ZlangRuntime *rt , struct ZlangObject *obj )
{
	struct ZlangDirectProperty_guiwindow		*guiwindow_direct_prop = GetObjectDirectProperty(obj) ;
	struct ZlangDirectProperty_guiwidget_common	*guiwindow_common = (struct ZlangDirectProperty_guiwidget_common *)guiwindow_direct_prop ;
	struct ZlangObject				*in1 = GetInputParameterInLocalObjectStack(rt,1) ;
	struct ZlangObject				*out1 = GetOutputParameterInLocalObjectStack(rt,1) ;
	struct ZlangObject				*new_guiwindow_obj = NULL ;
	int32_t						window_type ;
	struct ZlangObject				*parent_obj = NULL ;
	struct ZlangDirectProperty_guimenubar		*guimenubar_direct_prop = NULL ;
	struct ZlangDirectProperty_guitoolbar		*guitoolbar_direct_prop = NULL ;
	struct ZlangDirectProperty_guiboxlayout		*guicontent_direct_prop = NULL ;
	struct ZlangDirectProperty_guinotebooklayout	*guinotebooklayout_direct_prop = NULL ;
	struct ZlangDirectProperty_guiboxlayout		*guistatusbar_direct_prop = NULL ;
	int						nret = 0 ;

	CallRuntimeFunction_int_GetIntValue( rt , in1 , & window_type );

	guiwindow_direct_prop->window_type = window_type ;
	memset( & (guiwindow_direct_prop->window_type_data) , 0x00 , sizeof(union WindowTypeData) );

	if( guiwindow_direct_prop->window_type == GUIWINDOWTYPE_DIALOG )
	{
		/* Create vertical boxlayout */
		nret = CreateBoxLayout( rt , (struct ZlangDirectProperty_guiboxlayout *)&(guiwindow_direct_prop->window_type_data.dlg_win_layouts.guiboxlayout_common) , GUIORIENTATION_VERTICAL , 0 ) ;
		if( nret )
		{
			UnreferObject( rt , out1 );
			return 0;
		}
		SetGtkWidgetMarginWidth( guiwindow_direct_prop->window_type_data.dlg_win_layouts.guiboxlayout_common.gtk_widget , GUIWINDOW_DIALOG_MARGIN_DEFAULT );

		gtk_window_set_child( GTK_WINDOW(guiwindow_common->gtk_widget) , guiwindow_direct_prop->window_type_data.dlg_win_layouts.guiboxlayout_common.gtk_widget );
	}
	else if( guiwindow_direct_prop->window_type == GUIWINDOWTYPE_SINGLE_DOCUMENT )
	{
		new_guiwindow_obj = TransferInputObjectToNewObject( rt , obj ) ;
		if( new_guiwindow_obj == NULL )
		{
			UnreferObject( rt , out1 );
			return 0;
		}

		/* Create vertical boxlayout */
		nret = CreateBoxLayout( rt , (struct ZlangDirectProperty_guiboxlayout *)&(guiwindow_direct_prop->window_type_data.single_doc_win_layouts.guiboxlayout_common) , GUIORIENTATION_VERTICAL , 1 ) ;
		if( nret )
		{
			UnreferObject( rt , out1 );
			return 0;
		}

		gtk_window_set_child( GTK_WINDOW(guiwindow_common->gtk_widget) , guiwindow_direct_prop->window_type_data.single_doc_win_layouts.guiboxlayout_common.gtk_widget );

		/* Create menubar */
		parent_obj = QueryGlobalObjectByObjectName( rt , ZLANG_OBJECT_guimenubar ) ;
		if( parent_obj == NULL )
		{
			SET_RUNTIME_ERROR( rt , RUNTIME_ERROR , ZLANG_ERROR_OBJECT_NOT_IMPORTED_OR_DECLARED , "object '%s' not imported" , ZLANG_OBJECT_guimenubar )
			return ZLANG_ERROR_OBJECT_NOT_IMPORTED_OR_DECLARED;
		}
		nret = CloneObject( rt , & (guiwindow_direct_prop->window_type_data.single_doc_win_layouts.guimenubar_obj) , NULL , parent_obj ) ;
		if( nret )
		{
			return GetRuntimeErrorNo(rt);
		}
		guimenubar_direct_prop = GetObjectDirectProperty( guiwindow_direct_prop->window_type_data.single_doc_win_layouts.guimenubar_obj ) ;
		nret = CreateMenuBar( rt , guimenubar_direct_prop ) ;
		if( nret )
		{
			UnreferObject( rt , out1 );
			return 0;
		}
		guimenubar_direct_prop->common.guiwindow_obj = new_guiwindow_obj ;

		gtk_box_append( GTK_BOX(guiwindow_direct_prop->window_type_data.single_doc_win_layouts.guiboxlayout_common.gtk_widget) , guimenubar_direct_prop->common.gtk_widget );

		/* Create toolbar */
		parent_obj = QueryGlobalObjectByObjectName( rt , ZLANG_OBJECT_guitoolbar ) ;
		if( parent_obj == NULL )
		{
			SET_RUNTIME_ERROR( rt , RUNTIME_ERROR , ZLANG_ERROR_OBJECT_NOT_IMPORTED_OR_DECLARED , "object '%s' not imported" , ZLANG_OBJECT_guitoolbar )
			return ZLANG_ERROR_OBJECT_NOT_IMPORTED_OR_DECLARED;
		}
		nret = CloneObject( rt , & (guiwindow_direct_prop->window_type_data.single_doc_win_layouts.guitoolbar_obj) , NULL , parent_obj ) ;
		if( nret )
		{
			return GetRuntimeErrorNo(rt);
		}
		guitoolbar_direct_prop = GetObjectDirectProperty( guiwindow_direct_prop->window_type_data.single_doc_win_layouts.guitoolbar_obj ) ;
		nret = CreateToolBar( rt , guitoolbar_direct_prop ) ;
		if( nret )
		{
			UnreferObject( rt , out1 );
			return 0;
		}
		guitoolbar_direct_prop->common.guiwindow_obj = new_guiwindow_obj ;

		gtk_box_append( GTK_BOX(guiwindow_direct_prop->window_type_data.single_doc_win_layouts.guiboxlayout_common.gtk_widget) , guitoolbar_direct_prop->common.gtk_widget );

		/* Create content */
		parent_obj = QueryGlobalObjectByObjectName( rt , ZLANG_OBJECT_guiboxlayout ) ;
		if( parent_obj == NULL )
		{
			SET_RUNTIME_ERROR( rt , RUNTIME_ERROR , ZLANG_ERROR_OBJECT_NOT_IMPORTED_OR_DECLARED , "object '%s' not imported" , ZLANG_OBJECT_guiboxlayout )
			return ZLANG_ERROR_OBJECT_NOT_IMPORTED_OR_DECLARED;
		}
		nret = CloneObject( rt , & (guiwindow_direct_prop->window_type_data.single_doc_win_layouts.guicontent_obj) , NULL , parent_obj ) ;
		if( nret )
		{
			return GetRuntimeErrorNo(rt);
		}
		guicontent_direct_prop = GetObjectDirectProperty( guiwindow_direct_prop->window_type_data.single_doc_win_layouts.guicontent_obj ) ;
		nret = CreateBoxLayout( rt , guicontent_direct_prop , GTK_ORIENTATION_VERTICAL , 1 ) ;
		if( nret )
		{
			UnreferObject( rt , out1 );
			return 0;
		}
		guicontent_direct_prop->common.guiwindow_obj = new_guiwindow_obj ;

		gtk_widget_set_vexpand( guicontent_direct_prop->common.gtk_widget , TRUE );

		gtk_box_append( GTK_BOX(guiwindow_direct_prop->window_type_data.single_doc_win_layouts.guiboxlayout_common.gtk_widget) , guicontent_direct_prop->common.gtk_widget );

		/* Create statusbar */
		parent_obj = QueryGlobalObjectByObjectName( rt , ZLANG_OBJECT_guiboxlayout ) ;
		if( parent_obj == NULL )
		{
			SET_RUNTIME_ERROR( rt , RUNTIME_ERROR , ZLANG_ERROR_OBJECT_NOT_IMPORTED_OR_DECLARED , "object '%s' not imported" , ZLANG_OBJECT_guiboxlayout )
			return ZLANG_ERROR_OBJECT_NOT_IMPORTED_OR_DECLARED;
		}
		nret = CloneObject( rt , & (guiwindow_direct_prop->window_type_data.single_doc_win_layouts.guistatusbar_obj) , NULL , parent_obj ) ;
		if( nret )
		{
			return GetRuntimeErrorNo(rt);
		}
		guistatusbar_direct_prop = GetObjectDirectProperty( guiwindow_direct_prop->window_type_data.single_doc_win_layouts.guistatusbar_obj ) ;
		nret = CreateBoxLayout( rt , guistatusbar_direct_prop , GTK_ORIENTATION_HORIZONTAL , 1 ) ;
		if( nret )
		{
			UnreferObject( rt , out1 );
			return 0;
		}
		guistatusbar_direct_prop->common.guiwindow_obj = new_guiwindow_obj ;

		gtk_widget_set_hexpand( guistatusbar_direct_prop->common.gtk_widget , TRUE );
		gtk_box_set_homogeneous( GTK_BOX(guistatusbar_direct_prop->common.gtk_widget) , TRUE );

		gtk_box_append( GTK_BOX(guiwindow_direct_prop->window_type_data.single_doc_win_layouts.guiboxlayout_common.gtk_widget) , guistatusbar_direct_prop->common.gtk_widget );
	}
	else if( guiwindow_direct_prop->window_type == GUIWINDOWTYPE_MULTIPLE_DOCUMENT )
	{
		new_guiwindow_obj = TransferInputObjectToNewObject( rt , obj ) ;
		if( new_guiwindow_obj == NULL )
		{
			UnreferObject( rt , out1 );
			return 0;
		}

		/* Create vertical boxlayout */
		nret = CreateBoxLayout( rt , (struct ZlangDirectProperty_guiboxlayout *)&(guiwindow_direct_prop->window_type_data.multiple_doc_win_layouts.guiboxlayout_common) , GUIORIENTATION_VERTICAL , 1 ) ;
		if( nret )
		{
			UnreferObject( rt , out1 );
			return 0;
		}

		gtk_window_set_child( GTK_WINDOW(guiwindow_common->gtk_widget) , guiwindow_direct_prop->window_type_data.multiple_doc_win_layouts.guiboxlayout_common.gtk_widget );

		/* Create menubar */
		parent_obj = QueryGlobalObjectByObjectName( rt , ZLANG_OBJECT_guimenubar ) ;
		if( parent_obj == NULL )
		{
			SET_RUNTIME_ERROR( rt , RUNTIME_ERROR , ZLANG_ERROR_OBJECT_NOT_IMPORTED_OR_DECLARED , "object '%s' not imported" , ZLANG_OBJECT_guimenubar )
			return ZLANG_ERROR_OBJECT_NOT_IMPORTED_OR_DECLARED;
		}
		nret = CloneObject( rt , & (guiwindow_direct_prop->window_type_data.multiple_doc_win_layouts.guimenubar_obj) , NULL , parent_obj ) ;
		if( nret )
		{
			return GetRuntimeErrorNo(rt);
		}
		guimenubar_direct_prop = GetObjectDirectProperty( guiwindow_direct_prop->window_type_data.multiple_doc_win_layouts.guimenubar_obj ) ;
		nret = CreateMenuBar( rt , guimenubar_direct_prop ) ;
		if( nret )
		{
			UnreferObject( rt , out1 );
			return 0;
		}
		guimenubar_direct_prop->common.guiwindow_obj = new_guiwindow_obj ;

		gtk_box_append( GTK_BOX(guiwindow_direct_prop->window_type_data.multiple_doc_win_layouts.guiboxlayout_common.gtk_widget) , guimenubar_direct_prop->common.gtk_widget );

		/* Create toolbar */
		parent_obj = QueryGlobalObjectByObjectName( rt , ZLANG_OBJECT_guitoolbar ) ;
		if( parent_obj == NULL )
		{
			SET_RUNTIME_ERROR( rt , RUNTIME_ERROR , ZLANG_ERROR_OBJECT_NOT_IMPORTED_OR_DECLARED , "object '%s' not imported" , ZLANG_OBJECT_guitoolbar )
			return ZLANG_ERROR_OBJECT_NOT_IMPORTED_OR_DECLARED;
		}
		nret = CloneObject( rt , & (guiwindow_direct_prop->window_type_data.multiple_doc_win_layouts.guitoolbar_obj) , NULL , parent_obj ) ;
		if( nret )
		{
			return GetRuntimeErrorNo(rt);
		}
		guitoolbar_direct_prop = GetObjectDirectProperty( guiwindow_direct_prop->window_type_data.multiple_doc_win_layouts.guitoolbar_obj ) ;
		nret = CreateToolBar( rt , guitoolbar_direct_prop ) ;
		if( nret )
		{
			UnreferObject( rt , out1 );
			return 0;
		}
		guitoolbar_direct_prop->common.guiwindow_obj = new_guiwindow_obj ;

		gtk_box_append( GTK_BOX(guiwindow_direct_prop->window_type_data.multiple_doc_win_layouts.guiboxlayout_common.gtk_widget) , guitoolbar_direct_prop->common.gtk_widget );

		/* Create notebook */
		parent_obj = QueryGlobalObjectByObjectName( rt , ZLANG_OBJECT_guinotebooklayout ) ;
		if( parent_obj == NULL )
		{
			SET_RUNTIME_ERROR( rt , RUNTIME_ERROR , ZLANG_ERROR_OBJECT_NOT_IMPORTED_OR_DECLARED , "object '%s' not imported" , ZLANG_OBJECT_guinotebooklayout )
			return ZLANG_ERROR_OBJECT_NOT_IMPORTED_OR_DECLARED;
		}
		nret = CloneObject( rt , & (guiwindow_direct_prop->window_type_data.multiple_doc_win_layouts.guinotebooklayout_obj) , NULL , parent_obj ) ;
		if( nret )
		{
			return GetRuntimeErrorNo(rt);
		}
		guinotebooklayout_direct_prop = GetObjectDirectProperty( guiwindow_direct_prop->window_type_data.multiple_doc_win_layouts.guinotebooklayout_obj ) ;
		nret = CreateNotebookLayout( rt , guinotebooklayout_direct_prop ) ;
		if( nret )
		{
			UnreferObject( rt , out1 );
			return 0;
		}
		guinotebooklayout_direct_prop->common.guiwindow_obj = new_guiwindow_obj ;

		gtk_widget_set_vexpand( guinotebooklayout_direct_prop->common.gtk_widget , TRUE );

		gtk_box_append( GTK_BOX(guiwindow_direct_prop->window_type_data.multiple_doc_win_layouts.guiboxlayout_common.gtk_widget) , guinotebooklayout_direct_prop->common.gtk_widget );

		/* Create statusbar */
		parent_obj = QueryGlobalObjectByObjectName( rt , ZLANG_OBJECT_guiboxlayout ) ;
		if( parent_obj == NULL )
		{
			SET_RUNTIME_ERROR( rt , RUNTIME_ERROR , ZLANG_ERROR_OBJECT_NOT_IMPORTED_OR_DECLARED , "object '%s' not imported" , ZLANG_OBJECT_guiboxlayout )
			return ZLANG_ERROR_OBJECT_NOT_IMPORTED_OR_DECLARED;
		}
		nret = CloneObject( rt , & (guiwindow_direct_prop->window_type_data.multiple_doc_win_layouts.guistatusbar_obj) , NULL , parent_obj ) ;
		if( nret )
		{
			return GetRuntimeErrorNo(rt);
		}
		guistatusbar_direct_prop = GetObjectDirectProperty( guiwindow_direct_prop->window_type_data.multiple_doc_win_layouts.guistatusbar_obj ) ;
		nret = CreateBoxLayout( rt , guistatusbar_direct_prop , GTK_ORIENTATION_HORIZONTAL , 1 ) ;
		if( nret )
		{
			UnreferObject( rt , out1 );
			return 0;
		}
		guistatusbar_direct_prop->common.guiwindow_obj = new_guiwindow_obj ;

		gtk_widget_set_hexpand( guistatusbar_direct_prop->common.gtk_widget , TRUE );
		gtk_box_set_homogeneous( GTK_BOX(guistatusbar_direct_prop->common.gtk_widget) , TRUE );

		gtk_box_append( GTK_BOX(guiwindow_direct_prop->window_type_data.multiple_doc_win_layouts.guiboxlayout_common.gtk_widget) , guistatusbar_direct_prop->common.gtk_widget );
	}

	TRANSFER_MASTER_OBJECT_TO_OUTPUT_OBJECT

	return 0;
}

ZlangInvokeFunction ZlangInvokeFunction_guiwindow_GetMenubar;
int ZlangInvokeFunction_guiwindow_GetMenubar( struct ZlangRuntime *rt , struct ZlangObject *obj )
{
	struct ZlangDirectProperty_guiwindow	*guiwindow_direct_prop = GetObjectDirectProperty(obj) ;
	struct ZlangObject			*out1 = GetOutputParameterInLocalObjectStack(rt,1) ;
	int					nret = 0 ;

	if( guiwindow_direct_prop->window_type == GUIWINDOWTYPE_DIALOG )
	{
		return ThrowErrorException( rt , ZLANG_ERROR_INVOKE_METHOD_RETURN , EXCEPTION_MESSAGE_WINDOW_TYPE_INVALID );
	}
	else if( guiwindow_direct_prop->window_type == GUIWINDOWTYPE_SINGLE_DOCUMENT )
	{
		nret = ReferObject( rt , out1 , guiwindow_direct_prop->window_type_data.single_doc_win_layouts.guimenubar_obj ) ;
		if( nret )
			return nret;
	}
	else if( guiwindow_direct_prop->window_type == GUIWINDOWTYPE_MULTIPLE_DOCUMENT )
	{
		nret = ReferObject( rt , out1 , guiwindow_direct_prop->window_type_data.multiple_doc_win_layouts.guimenubar_obj ) ;
		if( nret )
			return nret;
	}
	else
	{
		return ThrowErrorException( rt , ZLANG_ERROR_INVOKE_METHOD_RETURN , EXCEPTION_MESSAGE_WINDOW_TYPE_INVALID );
	}

	return 0;
}

ZlangInvokeFunction ZlangInvokeFunction_guiwindow_GetToolbar;
int ZlangInvokeFunction_guiwindow_GetToolbar( struct ZlangRuntime *rt , struct ZlangObject *obj )
{
	struct ZlangDirectProperty_guiwindow	*guiwindow_direct_prop = GetObjectDirectProperty(obj) ;
	struct ZlangObject			*out1 = GetOutputParameterInLocalObjectStack(rt,1) ;
	int					nret = 0 ;

	if( guiwindow_direct_prop->window_type == GUIWINDOWTYPE_DIALOG )
	{
		return ThrowErrorException( rt , ZLANG_ERROR_INVOKE_METHOD_RETURN , EXCEPTION_MESSAGE_WINDOW_TYPE_INVALID );
	}
	else if( guiwindow_direct_prop->window_type == GUIWINDOWTYPE_SINGLE_DOCUMENT )
	{
		nret = ReferObject( rt , out1 , guiwindow_direct_prop->window_type_data.single_doc_win_layouts.guitoolbar_obj ) ;
		if( nret )
			return nret;
	}
	else if( guiwindow_direct_prop->window_type == GUIWINDOWTYPE_MULTIPLE_DOCUMENT )
	{
		nret = ReferObject( rt , out1 , guiwindow_direct_prop->window_type_data.multiple_doc_win_layouts.guitoolbar_obj ) ;
		if( nret )
			return nret;
	}
	else
	{
		return ThrowErrorException( rt , ZLANG_ERROR_INVOKE_METHOD_RETURN , EXCEPTION_MESSAGE_WINDOW_TYPE_INVALID );
	}

	return 0;
}

ZlangInvokeFunction ZlangInvokeFunction_guiwindow_GetContent;
int ZlangInvokeFunction_guiwindow_GetContent( struct ZlangRuntime *rt , struct ZlangObject *obj )
{
	struct ZlangDirectProperty_guiwindow	*guiwindow_direct_prop = GetObjectDirectProperty(obj) ;
	struct ZlangObject			*out1 = GetOutputParameterInLocalObjectStack(rt,1) ;
	int					nret = 0 ;

	if( guiwindow_direct_prop->window_type == GUIWINDOWTYPE_DIALOG )
	{
		return ThrowErrorException( rt , ZLANG_ERROR_INVOKE_METHOD_RETURN , EXCEPTION_MESSAGE_WINDOW_TYPE_INVALID );
	}
	else if( guiwindow_direct_prop->window_type == GUIWINDOWTYPE_SINGLE_DOCUMENT )
	{
		nret = ReferObject( rt , out1 , guiwindow_direct_prop->window_type_data.single_doc_win_layouts.guicontent_obj ) ;
		if( nret )
			return nret;
	}
	else if( guiwindow_direct_prop->window_type == GUIWINDOWTYPE_MULTIPLE_DOCUMENT )
	{
		return ThrowErrorException( rt , ZLANG_ERROR_INVOKE_METHOD_RETURN , EXCEPTION_MESSAGE_WINDOW_TYPE_INVALID );
	}
	else
	{
		return ThrowErrorException( rt , ZLANG_ERROR_INVOKE_METHOD_RETURN , EXCEPTION_MESSAGE_WINDOW_TYPE_INVALID );
	}

	return 0;
}

ZlangInvokeFunction ZlangInvokeFunction_guiwindow_GetNotebook;
int ZlangInvokeFunction_guiwindow_GetNotebook( struct ZlangRuntime *rt , struct ZlangObject *obj )
{
	struct ZlangDirectProperty_guiwindow	*guiwindow_direct_prop = GetObjectDirectProperty(obj) ;
	struct ZlangObject			*out1 = GetOutputParameterInLocalObjectStack(rt,1) ;
	int					nret = 0 ;

	if( guiwindow_direct_prop->window_type == GUIWINDOWTYPE_DIALOG )
	{
		return ThrowErrorException( rt , ZLANG_ERROR_INVOKE_METHOD_RETURN , EXCEPTION_MESSAGE_WINDOW_TYPE_INVALID );
	}
	else if( guiwindow_direct_prop->window_type == GUIWINDOWTYPE_SINGLE_DOCUMENT )
	{
		return ThrowErrorException( rt , ZLANG_ERROR_INVOKE_METHOD_RETURN , EXCEPTION_MESSAGE_WINDOW_TYPE_INVALID );
	}
	else if( guiwindow_direct_prop->window_type == GUIWINDOWTYPE_MULTIPLE_DOCUMENT )
	{
		nret = ReferObject( rt , out1 , guiwindow_direct_prop->window_type_data.multiple_doc_win_layouts.guinotebooklayout_obj ) ;
		if( nret )
			return nret;
	}
	else
	{
		return ThrowErrorException( rt , ZLANG_ERROR_INVOKE_METHOD_RETURN , EXCEPTION_MESSAGE_WINDOW_TYPE_INVALID );
	}

	return 0;
}

ZlangInvokeFunction ZlangInvokeFunction_guiwindow_GetStatusbar;
int ZlangInvokeFunction_guiwindow_GetStatusbar( struct ZlangRuntime *rt , struct ZlangObject *obj )
{
	struct ZlangDirectProperty_guiwindow	*guiwindow_direct_prop = GetObjectDirectProperty(obj) ;
	struct ZlangObject			*out1 = GetOutputParameterInLocalObjectStack(rt,1) ;
	int					nret = 0 ;

	if( guiwindow_direct_prop->window_type == GUIWINDOWTYPE_DIALOG )
	{
		return ThrowErrorException( rt , ZLANG_ERROR_INVOKE_METHOD_RETURN , EXCEPTION_MESSAGE_WINDOW_TYPE_INVALID );
	}
	else if( guiwindow_direct_prop->window_type == GUIWINDOWTYPE_SINGLE_DOCUMENT )
	{
		nret = ReferObject( rt , out1 , guiwindow_direct_prop->window_type_data.single_doc_win_layouts.guistatusbar_obj ) ;
		if( nret )
			return nret;
	}
	else if( guiwindow_direct_prop->window_type == GUIWINDOWTYPE_MULTIPLE_DOCUMENT )
	{
		nret = ReferObject( rt , out1 , guiwindow_direct_prop->window_type_data.multiple_doc_win_layouts.guistatusbar_obj ) ;
		if( nret )
			return nret;
	}
	else
	{
		return ThrowErrorException( rt , ZLANG_ERROR_INVOKE_METHOD_RETURN , EXCEPTION_MESSAGE_WINDOW_TYPE_INVALID );
	}

	return 0;
}

ZlangInvokeFunction ZlangInvokeFunction_guiwindow_RemoveToolbar;
int ZlangInvokeFunction_guiwindow_RemoveToolbar( struct ZlangRuntime *rt , struct ZlangObject *obj )
{
	struct ZlangDirectProperty_guiwindow	*guiwindow_direct_prop = GetObjectDirectProperty(obj) ;

	if( guiwindow_direct_prop->window_type == GUIWINDOWTYPE_DIALOG )
	{
		return ThrowErrorException( rt , ZLANG_ERROR_INVOKE_METHOD_RETURN , EXCEPTION_MESSAGE_WINDOW_TYPE_INVALID );
	}
	else if( guiwindow_direct_prop->window_type == GUIWINDOWTYPE_SINGLE_DOCUMENT )
	{
		struct ZlangDirectProperty_guitoolbar *guitoolbar_direct_prop = GetObjectDirectProperty( guiwindow_direct_prop->window_type_data.single_doc_win_layouts.guitoolbar_obj ) ;
		gtk_box_remove( GTK_BOX(guiwindow_direct_prop->window_type_data.single_doc_win_layouts.guiboxlayout_common.gtk_widget) , guitoolbar_direct_prop->common.gtk_widget );
		guiwindow_direct_prop->window_type_data.single_doc_win_layouts.guitoolbar_obj = NULL ;
	}
	else if( guiwindow_direct_prop->window_type == GUIWINDOWTYPE_MULTIPLE_DOCUMENT )
	{
		struct ZlangDirectProperty_guitoolbar *guitoolbar_direct_prop = GetObjectDirectProperty( guiwindow_direct_prop->window_type_data.multiple_doc_win_layouts.guitoolbar_obj ) ;
		gtk_box_remove( GTK_BOX(guiwindow_direct_prop->window_type_data.multiple_doc_win_layouts.guiboxlayout_common.gtk_widget) , guitoolbar_direct_prop->common.gtk_widget );
		guiwindow_direct_prop->window_type_data.multiple_doc_win_layouts.guitoolbar_obj = NULL ;
	}
	else
	{
		return ThrowErrorException( rt , ZLANG_ERROR_INVOKE_METHOD_RETURN , EXCEPTION_MESSAGE_WINDOW_TYPE_INVALID );
	}

	return 0;
}

ZlangInvokeFunction ZlangInvokeFunction_guiwindow_SetWindowMarginWidth_int;
int ZlangInvokeFunction_guiwindow_SetWindowMarginWidth_int( struct ZlangRuntime *rt , struct ZlangObject *obj )
{
	struct ZlangDirectProperty_guiwindow		*guiwindow_direct_prop = GetObjectDirectProperty(obj) ;
	struct ZlangDirectProperty_guiwidget_common	*guiwindow_common = (struct ZlangDirectProperty_guiwidget_common *)guiwindow_direct_prop ;
	struct ZlangObject				*in1 = GetInputParameterInLocalObjectStack(rt,1) ;
	int32_t						window_margin_width ;

	CallRuntimeFunction_int_GetIntValue( rt , in1 , & window_margin_width );

	if( guiwindow_direct_prop->window_type == GUIWINDOWTYPE_DIALOG )
	{
		SetGtkWidgetMarginWidth( guiwindow_common->gtk_widget , window_margin_width );
	}
	else if( guiwindow_direct_prop->window_type == GUIWINDOWTYPE_SINGLE_DOCUMENT )
	{
	}
	else if( guiwindow_direct_prop->window_type == GUIWINDOWTYPE_MULTIPLE_DOCUMENT )
	{
	}

	return 0;
}

ZLANG_INVOKE_FUNCTION_guiwidget_all_common_functions( window )

ZLANG_INVOKE_FUNCTION_guilayout_all_common_functions( window )

ZlangInvokeFunction ZlangInvokeFunction_guiwindow_IsActive;
int ZlangInvokeFunction_guiwindow_IsActive( struct ZlangRuntime *rt , struct ZlangObject *obj )
{
	struct ZlangDirectProperty_guiwindow		*guiwindow_direct_prop = GetObjectDirectProperty(obj) ;
	struct ZlangDirectProperty_guiwidget_common	*guiwindow_common = (struct ZlangDirectProperty_guiwidget_common *)guiwindow_direct_prop ;
	struct ZlangObject				*out1 = GetOutputParameterInLocalObjectStack(rt,1) ;
	unsigned char					b ;
	
	b = gtk_window_is_active( GTK_WINDOW(guiwindow_common->gtk_widget) ) ;

	CallRuntimeFunction_bool_SetBoolValue( rt , out1 , b );
	return 0;
}

ZlangInvokeFunction ZlangInvokeFunction_guiwindow_IsFullscreen;
int ZlangInvokeFunction_guiwindow_IsFullscreen( struct ZlangRuntime *rt , struct ZlangObject *obj )
{
	struct ZlangDirectProperty_guiwindow		*guiwindow_direct_prop = GetObjectDirectProperty(obj) ;
	struct ZlangDirectProperty_guiwidget_common	*guiwindow_common = (struct ZlangDirectProperty_guiwidget_common *)guiwindow_direct_prop ;
	struct ZlangObject				*out1 = GetOutputParameterInLocalObjectStack(rt,1) ;
	unsigned char					b ;
	
	b = gtk_window_is_fullscreen( GTK_WINDOW(guiwindow_common->gtk_widget) ) ;

	CallRuntimeFunction_bool_SetBoolValue( rt , out1 , b );
	return 0;
}

ZlangInvokeFunction ZlangInvokeFunction_guiwindow_IsMaximized;
int ZlangInvokeFunction_guiwindow_IsMaximized( struct ZlangRuntime *rt , struct ZlangObject *obj )
{
	struct ZlangDirectProperty_guiwindow		*guiwindow_direct_prop = GetObjectDirectProperty(obj) ;
	struct ZlangDirectProperty_guiwidget_common	*guiwindow_common = (struct ZlangDirectProperty_guiwidget_common *)guiwindow_direct_prop ;
	struct ZlangObject				*out1 = GetOutputParameterInLocalObjectStack(rt,1) ;
	unsigned char					b ;
	
	b = gtk_window_is_maximized( GTK_WINDOW(guiwindow_common->gtk_widget) ) ;

	CallRuntimeFunction_bool_SetBoolValue( rt , out1 , b );
	return 0;
}

ZlangInvokeFunction ZlangInvokeFunction_guiwindow_SetWindowActiveEventCallback_functionptr;
int ZlangInvokeFunction_guiwindow_SetWindowActiveEventCallback_functionptr( struct ZlangRuntime *rt , struct ZlangObject *obj )
{
	struct ZlangObject			*in1 = GetInputParameterInLocalObjectStack(rt,1) ;

	SetWindowStateEventCallback( rt , obj , GTK_EVENT_NOTIFY_IS_ACTIVE , in1 );

	return 0;
}

ZlangInvokeFunction ZlangInvokeFunction_guiwindow_SetWindowMaximizedEventCallback_functionptr;
int ZlangInvokeFunction_guiwindow_SetWindowMaximizedEventCallback_functionptr( struct ZlangRuntime *rt , struct ZlangObject *obj )
{
	struct ZlangObject			*in1 = GetInputParameterInLocalObjectStack(rt,1) ;

	SetWindowStateEventCallback( rt , obj , GTK_EVENT_NOTIFY_MAXIMIZED , in1 );

	return 0;
}

ZlangInvokeFunction ZlangInvokeFunction_guiwindow_SetWindowMinimizedEventCallback_functionptr;
int ZlangInvokeFunction_guiwindow_SetWindowMinimizedEventCallback_functionptr( struct ZlangRuntime *rt , struct ZlangObject *obj )
{
	struct ZlangObject			*in1 = GetInputParameterInLocalObjectStack(rt,1) ;

	SetWindowStateEventCallback( rt , obj , GTK_EVENT_NOTIFY_MINIMIZED , in1 );

	return 0;
}

ZlangInvokeFunction ZlangInvokeFunction_guiwindow_SetWindowFullscreenedEventCallback_functionptr;
int ZlangInvokeFunction_guiwindow_SetWindowFullscreenedEventCallback_functionptr( struct ZlangRuntime *rt , struct ZlangObject *obj )
{
	struct ZlangObject			*in1 = GetInputParameterInLocalObjectStack(rt,1) ;

	SetWindowStateEventCallback( rt , obj , GTK_EVENT_NOTIFY_FULLSCREENED , in1 );

	return 0;
}

ZlangInvokeFunction ZlangInvokeFunction_guiwindow_SetCloseWindowEventCallback_functionptr;
int ZlangInvokeFunction_guiwindow_SetCloseWindowEventCallback_functionptr( struct ZlangRuntime *rt , struct ZlangObject *obj )
{
	struct ZlangDirectProperty_guiwindow	*guiwindow_direct_prop = GetObjectDirectProperty(obj) ;
	struct ZlangObject			*in1 = GetInputParameterInLocalObjectStack(rt,1) ;

	SetCloseWindowEventCallback( rt , obj , GTK_EVENT_CLOSE_REQUEST , in1 );

	guiwindow_direct_prop->had_set_close_window_callback = TRUE ;

	return 0;
}

ZlangInvokeFunction ZlangInvokeFunction_guiwindow_SetKeyPressEventCallback_functionptr;
int ZlangInvokeFunction_guiwindow_SetKeyPressEventCallback_functionptr( struct ZlangRuntime *rt , struct ZlangObject *obj )
{
	struct ZlangObject			*in1 = GetInputParameterInLocalObjectStack(rt,1) ;

	AddWindowKeyEventCallback( rt , obj , GTK_EVENT_KEY_PRESSED , in1 );

	return 0;
}

ZlangInvokeFunction ZlangInvokeFunction_guiwindow_SetKeyReleaseEventCallback_functionptr;
int ZlangInvokeFunction_guiwindow_SetKeyReleaseEventCallback_functionptr( struct ZlangRuntime *rt , struct ZlangObject *obj )
{
	struct ZlangObject			*in1 = GetInputParameterInLocalObjectStack(rt,1) ;

	AddWindowKeyEventCallback( rt , obj , GTK_EVENT_KEY_RELEASED , in1 );

	return 0;
}

ZlangInvokeFunction ZlangInvokeFunction_guiwindow_SetMouseButtonPressEventCallback_functionptr;
int ZlangInvokeFunction_guiwindow_SetMouseButtonPressEventCallback_functionptr( struct ZlangRuntime *rt , struct ZlangObject *obj )
{
	struct ZlangObject			*in1 = GetInputParameterInLocalObjectStack(rt,1) ;

	AddWindowMouseButtonEventCallback( rt , obj , GTK_EVENT_PRESSED , in1 );

	return 0;
}

ZlangInvokeFunction ZlangInvokeFunction_guiwindow_SetMouseButtonReleaseEventCallback_functionptr;
int ZlangInvokeFunction_guiwindow_SetMouseButtonReleaseEventCallback_functionptr( struct ZlangRuntime *rt , struct ZlangObject *obj )
{
	struct ZlangObject			*in1 = GetInputParameterInLocalObjectStack(rt,1) ;

	AddWindowMouseButtonEventCallback( rt , obj , GTK_EVENT_RELEASED , in1 );

	return 0;
}

ZlangInvokeFunction ZlangInvokeFunction_guiwindow_ShowWindow;
int ZlangInvokeFunction_guiwindow_ShowWindow( struct ZlangRuntime *rt , struct ZlangObject *obj )
{
	struct ZlangDirectProperty_guiwindow		*guiwindow_direct_prop = GetObjectDirectProperty(obj) ;
	struct ZlangDirectProperty_guiwidget_common	*guiwindow_common = (struct ZlangDirectProperty_guiwidget_common *)guiwindow_direct_prop ;
	struct WindowCallbackContext			*win_callback_ctx = NULL ;
	struct ControlCallbackContext			*ctl_callback_ctx = NULL ;
	struct ZlangDirectProperty_guiwidget_common	*guictl_common = NULL ;

	if( guiwindow_direct_prop->is_showed == FALSE )
	{
		list_for_each_entry( win_callback_ctx , & (guiwindow_direct_prop->win_gene_callback_ctx_list) , struct WindowCallbackContext , win_callback_ctx_list_node )
		{
			g_signal_connect( guiwindow_common->gtk_widget , win_callback_ctx->event_name , G_CALLBACK(OnGtkWindowGeneralEventProc) , win_callback_ctx );
		}

		list_for_each_entry( win_callback_ctx , & (guiwindow_direct_prop->win_focus_callback_ctx_list) , struct WindowCallbackContext , win_callback_ctx_list_node )
		{
			g_signal_connect( guiwindow_common->gtk_widget , win_callback_ctx->event_name , G_CALLBACK(OnGtkWindowFocusEventProc) , win_callback_ctx );
		}

		list_for_each_entry( win_callback_ctx , & (guiwindow_direct_prop->win_unfocus_callback_ctx_list) , struct WindowCallbackContext , win_callback_ctx_list_node )
		{
			g_signal_connect( guiwindow_common->gtk_widget , win_callback_ctx->event_name , G_CALLBACK(OnGtkWindowFocusEventProc) , win_callback_ctx );
		}

		list_for_each_entry( win_callback_ctx , & (guiwindow_direct_prop->win_key_callback_ctx_list) , struct WindowCallbackContext , win_callback_ctx_list_node )
		{
			GtkEventController *controller = gtk_event_controller_key_new() ;
			g_signal_connect( controller , win_callback_ctx->event_name , G_CALLBACK(OnGtkWindowKeyEventProc) , win_callback_ctx );
			gtk_widget_add_controller( guiwindow_common->gtk_widget , controller );
		}

		list_for_each_entry( win_callback_ctx , & (guiwindow_direct_prop->win_mouse_button_callback_ctx_list) , struct WindowCallbackContext , win_callback_ctx_list_node )
		{
			GtkGesture *gesture = gtk_gesture_click_new();
			gtk_gesture_single_set_button( GTK_GESTURE_SINGLE(gesture) , 0 );
			g_signal_connect( gesture , win_callback_ctx->event_name , G_CALLBACK(OnGtkWindowMouseButtonEventProc) , win_callback_ctx );
			gtk_widget_add_controller( guiwindow_common->gtk_widget , GTK_EVENT_CONTROLLER(gesture) );
		}

		list_for_each_entry( win_callback_ctx , & (guiwindow_direct_prop->win_state_callback_ctx_list) , struct WindowCallbackContext , win_callback_ctx_list_node )
		{
			g_signal_connect( guiwindow_common->gtk_widget , win_callback_ctx->event_name , G_CALLBACK(OnGtkWindowStateEventProc) , win_callback_ctx );
		}

		list_for_each_entry( win_callback_ctx , & (guiwindow_direct_prop->win_timer_callback_ctx_list) , struct WindowCallbackContext , win_callback_ctx_list_node )
		{
			win_callback_ctx->timer_id = g_timeout_add( win_callback_ctx->interval_milliseconds , G_SOURCE_FUNC(OnGtkWindowTimerEventProc) , win_callback_ctx ) ;
		}

		if( guiwindow_direct_prop->win_close_callback_ctx )
		{
			g_signal_connect( guiwindow_common->gtk_widget , guiwindow_direct_prop->win_close_callback_ctx->event_name , G_CALLBACK(OnGtkCloseWindowEventProc) , guiwindow_direct_prop->win_close_callback_ctx );
		}

		list_for_each_entry( ctl_callback_ctx , & (guiwindow_direct_prop->ctl_gene_callback_ctx_list) , struct ControlCallbackContext , ctl_callback_ctx_list_node )
		{
			guictl_common = (struct ZlangDirectProperty_guiwidget_common *)GetObjectDirectProperty(ctl_callback_ctx->guictl_obj) ;
			g_signal_connect( GetControlGtkEventBoxOrInnerOrWidget(guictl_common) , ctl_callback_ctx->event_name , G_CALLBACK(OnGtkControlGeneralEventProc) , ctl_callback_ctx );
		}

		list_for_each_entry( ctl_callback_ctx , & (guiwindow_direct_prop->ctl_focus_callback_ctx_list) , struct ControlCallbackContext , ctl_callback_ctx_list_node )
		{
			guictl_common = (struct ZlangDirectProperty_guiwidget_common *)GetObjectDirectProperty(ctl_callback_ctx->guictl_obj) ;

			GtkEventController *controller = gtk_event_controller_focus_new() ;
			g_signal_connect( controller , ctl_callback_ctx->event_name , G_CALLBACK(OnGtkControlFocusEventProc) , ctl_callback_ctx );
			gtk_widget_add_controller( guictl_common->gtk_widget , controller );
		}

		list_for_each_entry( ctl_callback_ctx , & (guiwindow_direct_prop->ctl_unfocus_callback_ctx_list) , struct ControlCallbackContext , ctl_callback_ctx_list_node )
		{
			guictl_common = (struct ZlangDirectProperty_guiwidget_common *)GetObjectDirectProperty(ctl_callback_ctx->guictl_obj) ;

			GtkEventController *controller = gtk_event_controller_focus_new() ;
			g_signal_connect( controller , ctl_callback_ctx->event_name , G_CALLBACK(OnGtkControlFocusEventProc) , ctl_callback_ctx );
			gtk_widget_add_controller( guictl_common->gtk_widget , controller );
		}

		list_for_each_entry( ctl_callback_ctx , & (guiwindow_direct_prop->ctl_key_callback_ctx_list) , struct ControlCallbackContext , ctl_callback_ctx_list_node )
		{
			guictl_common = (struct ZlangDirectProperty_guiwidget_common *)GetObjectDirectProperty(ctl_callback_ctx->guictl_obj) ;
			GtkEventController *controller = gtk_event_controller_key_new() ;
			g_signal_connect( controller , ctl_callback_ctx->event_name , G_CALLBACK(OnGtkControlKeyEventProc) , ctl_callback_ctx );
			gtk_widget_add_controller( guictl_common->gtk_widget , controller );
		}

		list_for_each_entry( ctl_callback_ctx , & (guiwindow_direct_prop->ctl_mouse_button_callback_ctx_list) , struct ControlCallbackContext , ctl_callback_ctx_list_node )
		{
			guictl_common = (struct ZlangDirectProperty_guiwidget_common *)GetObjectDirectProperty(ctl_callback_ctx->guictl_obj) ;
			GtkGesture *gesture = gtk_gesture_click_new();
			gtk_gesture_single_set_button( GTK_GESTURE_SINGLE(gesture) , 0 );
			g_signal_connect( gesture , ctl_callback_ctx->event_name , G_CALLBACK(OnGtkControlMouseButtonEventProc) , ctl_callback_ctx );
			gtk_event_controller_set_propagation_phase( GTK_EVENT_CONTROLLER(gesture) , GTK_PHASE_CAPTURE );
			gtk_widget_add_controller( guictl_common->gtk_widget , GTK_EVENT_CONTROLLER(gesture) );
		}

		list_for_each_entry( ctl_callback_ctx , & (guiwindow_direct_prop->ctl_listbox_row_callback_ctx_list) , struct ControlCallbackContext , ctl_callback_ctx_list_node )
		{
			guictl_common = (struct ZlangDirectProperty_guiwidget_common *)GetObjectDirectProperty(ctl_callback_ctx->guictl_obj) ;
			g_signal_connect( GetControlGtkEventBoxOrInnerOrWidget(guictl_common) , ctl_callback_ctx->event_name , G_CALLBACK(OnGtkControlListboxRowEventProc) , ctl_callback_ctx );
		}

		list_for_each_entry( ctl_callback_ctx , & (guiwindow_direct_prop->ctl_flowbox_child_activated_callback_ctx_list) , struct ControlCallbackContext , ctl_callback_ctx_list_node )
		{
			guictl_common = (struct ZlangDirectProperty_guiwidget_common *)GetObjectDirectProperty(ctl_callback_ctx->guictl_obj) ;
			g_signal_connect( GetControlGtkEventBoxOrInnerOrWidget(guictl_common) , ctl_callback_ctx->event_name , G_CALLBACK(OnGtkControlFlowboxChildActivatedEventProc) , ctl_callback_ctx );
		}

		list_for_each_entry( ctl_callback_ctx , & (guiwindow_direct_prop->ctl_notify_callback_ctx_list) , struct ControlCallbackContext , ctl_callback_ctx_list_node )
		{
			guictl_common = (struct ZlangDirectProperty_guiwidget_common *)GetObjectDirectProperty(ctl_callback_ctx->guictl_obj) ;
			g_signal_connect( GetControlGtkEventBoxOrInnerOrWidget(guictl_common) , ctl_callback_ctx->event_name , G_CALLBACK(OnGtkControlNotifyEventProc) , ctl_callback_ctx );
		}

		list_for_each_entry( ctl_callback_ctx , & (guiwindow_direct_prop->ctl_menu_item_callback_ctx_list) , struct ControlCallbackContext , ctl_callback_ctx_list_node )
		{
			g_signal_connect( ctl_callback_ctx->action , ctl_callback_ctx->event_name , G_CALLBACK(OnGtkMenuItemEventProc) , ctl_callback_ctx );
			g_action_map_add_action( guiwindow_direct_prop->action_map , G_ACTION(ctl_callback_ctx->action) );
		}

		gtk_widget_insert_action_group( guiwindow_common->gtk_widget , "win" , G_ACTION_GROUP(guiwindow_direct_prop->action_group) ) ;

		gtk_widget_add_controller( guiwindow_common->gtk_widget , guiwindow_direct_prop->shortcut_controller );

		guiwindow_direct_prop->is_showed = TRUE ;

		if( guiwindow_direct_prop->had_set_close_window_callback == FALSE )
		{
			g_signal_connect( guiwindow_common->gtk_widget , "close-request" , G_CALLBACK(OnGtkCloseWindowEventProcDefault) , guiwindow_direct_prop ) ;
			guiwindow_direct_prop->had_set_close_window_callback = TRUE ;
		}
	}

	gtk_widget_show( guiwindow_common->gtk_widget );

	return 0;
}

ZlangInvokeFunction ZlangInvokeFunction_guiwindow_RunMainLoop;
int ZlangInvokeFunction_guiwindow_RunMainLoop( struct ZlangRuntime *rt , struct ZlangObject *obj )
{
	struct ZlangDirectProperty_guiwindow		*guiwindow_direct_prop = GetObjectDirectProperty(obj) ;

	guiwindow_direct_prop->main_loop = g_main_loop_new( NULL , FALSE ) ;

	g_main_loop_run( guiwindow_direct_prop->main_loop );

	g_main_loop_unref( guiwindow_direct_prop->main_loop );
	
	return GetRuntimeErrorNo(rt);
}

ZlangInvokeFunction ZlangInvokeFunction_guiwindow_HideWindow;
int ZlangInvokeFunction_guiwindow_HideWindow( struct ZlangRuntime *rt , struct ZlangObject *obj )
{
	struct ZlangDirectProperty_guiwindow		*guiwindow_direct_prop = GetObjectDirectProperty(obj) ;
	struct ZlangDirectProperty_guiwidget_common	*guiwindow_common = (struct ZlangDirectProperty_guiwidget_common *)guiwindow_direct_prop ;

	gtk_widget_hide( guiwindow_common->gtk_widget );

	return 0;
}

ZlangInvokeFunction ZlangInvokeFunction_guiwindow_OpenWindow;
int ZlangInvokeFunction_guiwindow_OpenWindow( struct ZlangRuntime *rt , struct ZlangObject *obj )
{
	int		nret = 0 ;

	nret = ZlangInvokeFunction_guiwindow_ShowWindow( rt , obj ) ;
	if( nret )
		return nret;
	else if( GetRuntimeErrorNo(rt) )
		return GetRuntimeErrorNo(rt);

	nret = ZlangInvokeFunction_guiwindow_RunMainLoop( rt , obj ) ;
	if( nret )
		return nret;
	else if( GetRuntimeErrorNo(rt) )
		return GetRuntimeErrorNo(rt);

	return 0;
}

ZlangInvokeFunction ZlangInvokeFunction_guiwindow_CloseWindow;
int ZlangInvokeFunction_guiwindow_CloseWindow( struct ZlangRuntime *rt , struct ZlangObject *obj )
{
	struct ZlangDirectProperty_guiwindow		*guiwindow_direct_prop = GetObjectDirectProperty(obj) ;
	int						nret = 0 ;

	nret = ZlangInvokeFunction_guiwindow_HideWindow( rt , obj ) ;
	if( nret )
		return nret;
	else if( GetRuntimeErrorNo(rt) )
		return GetRuntimeErrorNo(rt);

	g_main_loop_quit( guiwindow_direct_prop->main_loop );

	return 0;
}

ZlangInvokeFunction ZlangInvokeFunction_guiwindow_AddTimerEventCallback_string_int_functionptr;
int ZlangInvokeFunction_guiwindow_AddTimerEventCallback_string_int_functionptr( struct ZlangRuntime *rt , struct ZlangObject *obj )
{
	struct ZlangDirectProperty_guiwindow		*guiwindow_direct_prop = GetObjectDirectProperty(obj) ;
	struct ZlangDirectProperty_guiwidget_common	*guiwindow_common = (struct ZlangDirectProperty_guiwidget_common *)guiwindow_direct_prop ;
	struct ZlangObject				*in1 = GetInputParameterInLocalObjectStack(rt,1) ;
	struct ZlangObject				*in2 = GetInputParameterInLocalObjectStack(rt,2) ;
	struct ZlangObject				*in3 = GetInputParameterInLocalObjectStack(rt,3) ;
	char						*timer_name = NULL ;
	int32_t						interval_milliseconds ;
	struct ZlangObject				*new_funcp = NULL ;
	struct ZlangObject				*new_guiwindow_obj = NULL ;
	struct WindowCallbackContext			*win_callback_ctx = NULL ;

	CallRuntimeFunction_string_GetStringValue( rt , in1 , & timer_name , NULL );
	CallRuntimeFunction_int_GetIntValue( rt , in2 , & interval_milliseconds );
	
	new_funcp = TransferInputObjectToNewObject( rt , in3 ) ;
	if( new_funcp == NULL )
		return GetRuntimeErrorNo(rt);

	new_guiwindow_obj = TransferInputObjectToNewObject( rt , obj ) ;
	if( new_guiwindow_obj == NULL )
		return GetRuntimeErrorNo(rt);

	win_callback_ctx = malloc( sizeof(struct WindowCallbackContext) ) ;
	if( win_callback_ctx == NULL )
	{
		SET_RUNTIME_ERROR( rt , RUNTIME_ERROR , ZLANG_ERROR_ALLOC , "alloc failed" )
		return ThrowErrorException( rt , ZLANG_ERROR_ALLOC , EXCEPTION_MESSAGE_ALLOC_FAILED );
	}
	memset( win_callback_ctx , 0x00 , sizeof(struct WindowCallbackContext) );
	win_callback_ctx->event_name = strdup(timer_name) ;
	win_callback_ctx->interval_milliseconds = interval_milliseconds ;
	win_callback_ctx->funcp = new_funcp ;
	win_callback_ctx->rt = rt ;
	win_callback_ctx->guiwindow_obj = new_guiwindow_obj ;
	list_add_tail( & (win_callback_ctx->win_callback_ctx_list_node) , & (guiwindow_direct_prop->win_timer_callback_ctx_list) );

	if( guiwindow_direct_prop->is_showed == TRUE )
	{
		guiwindow_common->timer_id = g_timeout_add( win_callback_ctx->interval_milliseconds , G_SOURCE_FUNC(OnGtkWindowTimerEventProc) , win_callback_ctx ) ;
	}

	return 0;
}

ZlangInvokeFunction ZlangInvokeFunction_guiwindow_GetControlByName_string;
int ZlangInvokeFunction_guiwindow_GetControlByName_string( struct ZlangRuntime *rt , struct ZlangObject *obj )
{
	struct ZlangObject			*in1 = GetInputParameterInLocalObjectStack(rt,1) ;
	struct ZlangObject			*out1 = GetOutputParameterInLocalObjectStack(rt,1) ;
	char					*search_obj_name = NULL ;
	struct WindowCallbackControl		*win_callback_ctl_obj = NULL ;
	int					nret = 0 ;

	CallRuntimeFunction_string_GetStringValue( rt , in1 , & search_obj_name , NULL );
	
	win_callback_ctl_obj = GetControlByName( obj , search_obj_name ) ;
	if( win_callback_ctl_obj == NULL )
	{
		UnreferObject( rt , out1 );
		return 0;
	}

	nret = TransferMasterObjectToOutputObject( rt , out1 , win_callback_ctl_obj->guictl_obj ) ;
	if( nret )
	{
		TEST_RUNTIME_DEBUG_THEN_PRINT( rt , "ReferObject failed[%d]" , nret )
		return ThrowErrorException( rt , GetRuntimeErrorNo(rt) , EXCEPTION_MESSAGE_REFER_OBJECT_FAILED );
	}

	return 0;
}

ZlangInvokeFunction ZlangInvokeFunction_guiwindow_GetControlGroupSelectedRow_string;
int ZlangInvokeFunction_guiwindow_GetControlGroupSelectedRow_string( struct ZlangRuntime *rt , struct ZlangObject *obj )
{
	struct ZlangObject			*in1 = GetInputParameterInLocalObjectStack(rt,1) ;
	struct ZlangObject			*out1 = GetOutputParameterInLocalObjectStack(rt,1) ;
	char					*group_name = NULL ;
	struct WindowControlGroup		*gtk_ctl_grp = NULL ;
	int32_t					index ;

	CallRuntimeFunction_string_GetStringValue( rt , in1 , & group_name , NULL );

	gtk_ctl_grp = GetGtkControlGroup( rt , obj , group_name ) ;
	if( gtk_ctl_grp == NULL )
	{
		UnreferObject( rt , out1 );
		return 0;
	}

	index = GetGtkListSelectedRow( rt , gtk_ctl_grp->current_gslist_node ) ;
	if( index < 0 )
	{
		UnreferObject( rt , out1 );
		return 0;
	}

	CallRuntimeFunction_int_SetIntValue( rt , out1 , index+1 );
	return 0;
}

ZlangInvokeFunction ZlangInvokeFunction_guiwindow_GetControlGroupSelectedName_string;
int ZlangInvokeFunction_guiwindow_GetControlGroupSelectedName_string( struct ZlangRuntime *rt , struct ZlangObject *obj )
{
	struct ZlangObject			*in1 = GetInputParameterInLocalObjectStack(rt,1) ;
	struct ZlangObject			*out1 = GetOutputParameterInLocalObjectStack(rt,1) ;
	char					*group_name = NULL ;
	struct WindowControlGroup		*gtk_ctl_grp = NULL ;
	GtkWidget				*gtk_widget = NULL ;
	char					*str = NULL ;

	CallRuntimeFunction_string_GetStringValue( rt , in1 , & group_name , NULL );

	gtk_ctl_grp = GetGtkControlGroup( rt , obj , group_name ) ;
	if( gtk_ctl_grp == NULL )
	{
		UnreferObject( rt , out1 );
		return 0;
	}

	gtk_widget = GetGtkListSelectedWidget( rt , gtk_ctl_grp->current_gslist_node ) ;
	if( gtk_widget == NULL )
	{
		UnreferObject( rt , out1 );
		return 0;
	}

	str = g_object_get_data( (GObject*)gtk_widget , WIDGET_ZOBJECT_NAME );
	CallRuntimeFunction_string_SetStringValue( rt , out1 , str , STRLEN_OF_STRING );
	return 0;
}

ZlangInvokeFunction ZlangInvokeFunction_guiwindow_GetControlGroupSelectedString_string;
int ZlangInvokeFunction_guiwindow_GetControlGroupSelectedString_string( struct ZlangRuntime *rt , struct ZlangObject *obj )
{
	struct ZlangObject			*in1 = GetInputParameterInLocalObjectStack(rt,1) ;
	struct ZlangObject			*out1 = GetOutputParameterInLocalObjectStack(rt,1) ;
	char					*group_name = NULL ;
	struct WindowControlGroup		*gtk_ctl_grp = NULL ;
	GtkWidget				*gtk_widget = NULL ;
	char					*str = NULL ;

	CallRuntimeFunction_string_GetStringValue( rt , in1 , & group_name , NULL );

	gtk_ctl_grp = GetGtkControlGroup( rt , obj , group_name ) ;
	if( gtk_ctl_grp == NULL )
	{
		UnreferObject( rt , out1 );
		return 0;
	}

	gtk_widget = GetGtkListSelectedWidget( rt , gtk_ctl_grp->current_gslist_node ) ;
	if( gtk_widget == NULL )
	{
		UnreferObject( rt , out1 );
		return 0;
	}

	str = (char*)gtk_check_button_get_label( GTK_CHECK_BUTTON(gtk_widget) ) ;
	CallRuntimeFunction_string_SetStringValue( rt , out1 , str , STRLEN_OF_STRING );
	return 0;
}

ZlangInvokeFunction ZlangInvokeFunction_guiwindow_IconNamesToArray;
int ZlangInvokeFunction_guiwindow_IconNamesToArray( struct ZlangRuntime *rt , struct ZlangObject *obj )
{
	struct ZlangDirectProperty_guiwindow	*guiwindow_direct_prop = GetObjectDirectProperty(obj) ;
	struct ZlangObject			*out1 = GetOutputParameterInLocalObjectStack(rt,1) ;
	GtkIconTheme				*icon_theme = NULL ;
	char					**icon_names = NULL ;
	char					**pp_icon_name = NULL ;
	struct ZlangObject			*str_obj = NULL ;

	icon_theme = gtk_icon_theme_get_for_display( gtk_widget_get_display(guiwindow_direct_prop->common.gtk_widget) ) ;
	if( icon_theme == NULL )
	{
		UnreferObject( rt , out1 );
		return 0;
	}

	icon_names = gtk_icon_theme_get_icon_names( icon_theme ) ;
	if( icon_names == NULL )
	{
		UnreferObject( rt , out1 );
		return 0;
	}

	for( pp_icon_name = icon_names ; (*pp_icon_name) ; pp_icon_name++ )
	{
		str_obj = CloneStringObject( rt , NULL ) ;
		if( str_obj == NULL )
		{
			UnreferObject( rt , out1 );
			return ThrowErrorException( rt , ZLANG_ERROR_INVOKE_METHOD_RETURN , EXCEPTION_MESSAGE_ALLOC_OBJECT_FAILED );
		}
		CallRuntimeFunction_string_SetStringValue( rt , str_obj , (*pp_icon_name) , STRLEN_OF_STRING );
		CallRuntimeFunction_array_Append( rt , out1 , str_obj , NULL );
	}

	g_strfreev( icon_names );

	return 0;
}

ZlangInvokeFunction ZlangInvokeFunction_guiwindow_Debug;
int ZlangInvokeFunction_guiwindow_Debug( struct ZlangRuntime *rt , struct ZlangObject *obj )
{
	return 0;
}

ZlangCreateDirectPropertyFunction ZlangCreateDirectProperty_guiwindow;
void *ZlangCreateDirectProperty_guiwindow( struct ZlangRuntime *rt , struct ZlangObject *obj )
{
	struct ZlangDirectProperty_guiwindow		*guiwindow_prop = NULL ;
	struct ZlangDirectProperty_guiwidget_common	*guiwindow_common = NULL ;
	
	guiwindow_prop = (struct ZlangDirectProperty_guiwindow *)ZLMALLOC( sizeof(struct ZlangDirectProperty_guiwindow) ) ;
	if( guiwindow_prop == NULL )
	{
		SET_RUNTIME_ERROR( rt , RUNTIME_ERROR , ZLANG_ERROR_ALLOC , "alloc memory for entity" )
		return NULL;
	}
	memset( guiwindow_prop , 0x00 , sizeof(struct ZlangDirectProperty_guiwindow) );
	
	guiwindow_common = (struct ZlangDirectProperty_guiwidget_common *)guiwindow_prop ;
	guiwindow_common->gtk_widget_type_id = GTK_TYPE_WINDOW ;

	gtk_init();

	guiwindow_common->guiwindow_obj = obj ;
	guiwindow_common->gtk_widget = gtk_window_new() ;

	guiwindow_prop->action_group = g_simple_action_group_new() ;
	guiwindow_prop->action_map = G_ACTION_MAP(guiwindow_prop->action_group) ;

	guiwindow_prop->shortcut_controller = gtk_shortcut_controller_new() ;

	INIT_LIST_HEAD( & (guiwindow_prop->win_gene_callback_ctx_list) );
	INIT_LIST_HEAD( & (guiwindow_prop->win_focus_callback_ctx_list) );
	INIT_LIST_HEAD( & (guiwindow_prop->win_unfocus_callback_ctx_list) );
	INIT_LIST_HEAD( & (guiwindow_prop->win_key_callback_ctx_list) );
	INIT_LIST_HEAD( & (guiwindow_prop->win_mouse_button_callback_ctx_list) );
	INIT_LIST_HEAD( & (guiwindow_prop->win_state_callback_ctx_list) );
	INIT_LIST_HEAD( & (guiwindow_prop->win_timer_callback_ctx_list) );
	INIT_LIST_HEAD( & (guiwindow_prop->ctl_gene_callback_ctx_list) );
	INIT_LIST_HEAD( & (guiwindow_prop->ctl_focus_callback_ctx_list) );
	INIT_LIST_HEAD( & (guiwindow_prop->ctl_unfocus_callback_ctx_list) );
	INIT_LIST_HEAD( & (guiwindow_prop->ctl_key_callback_ctx_list) );
	INIT_LIST_HEAD( & (guiwindow_prop->ctl_mouse_button_callback_ctx_list) );
	INIT_LIST_HEAD( & (guiwindow_prop->ctl_listbox_row_callback_ctx_list) );
	INIT_LIST_HEAD( & (guiwindow_prop->ctl_flowbox_child_activated_callback_ctx_list) );
	INIT_LIST_HEAD( & (guiwindow_prop->ctl_notify_callback_ctx_list) );
	INIT_LIST_HEAD( & (guiwindow_prop->ctl_menu_item_callback_ctx_list) );
	INIT_LIST_HEAD( & (guiwindow_prop->win_callback_ctl_list) );
	INIT_LIST_HEAD( & (guiwindow_prop->win_ctl_grp_list) );

	return guiwindow_prop;
}

ZlangDestroyDirectPropertyFunction ZlangDestroyDirectProperty_guiwindow;
void ZlangDestroyDirectProperty_guiwindow( struct ZlangRuntime *rt , struct ZlangObject *obj )
{
	struct ZlangDirectProperty_guiwindow	*guiwindow_direct_prop = GetObjectDirectProperty(obj) ;
	struct WindowCallbackContext		*win_callback_ctx = NULL ;
	struct WindowCallbackContext		*next_win_callback_ctx = NULL ;
	struct ControlCallbackContext		*ctl_callback_ctx = NULL ;
	struct ControlCallbackContext		*next_ctl_callback_ctx = NULL ;
	struct WindowCallbackControl		*win_callback_obj = NULL ;
	struct WindowCallbackControl		*next_win_callback_obj = NULL ;
	struct WindowControlGroup		*win_ctl_grp = NULL ;
	struct WindowControlGroup		*next_win_ctl_grp = NULL ;

	if( guiwindow_direct_prop->window_type == GUIWINDOWTYPE_SINGLE_DOCUMENT )
	{
	}
	else if( guiwindow_direct_prop->window_type == GUIWINDOWTYPE_MULTIPLE_DOCUMENT )
	{
	}
	else if( guiwindow_direct_prop->window_type == GUIWINDOWTYPE_DIALOG )
	{
	}

	list_for_each_entry_safe( win_callback_ctx , next_win_callback_ctx , & (guiwindow_direct_prop->win_gene_callback_ctx_list) , struct WindowCallbackContext , win_callback_ctx_list_node )
	{
		list_del( & (win_callback_ctx->win_callback_ctx_list_node) );

		free( win_callback_ctx );
	}

	list_for_each_entry_safe( win_callback_ctx , next_win_callback_ctx , & (guiwindow_direct_prop->win_focus_callback_ctx_list) , struct WindowCallbackContext , win_callback_ctx_list_node )
	{
		list_del( & (win_callback_ctx->win_callback_ctx_list_node) );

		free( win_callback_ctx );
	}

	list_for_each_entry_safe( win_callback_ctx , next_win_callback_ctx , & (guiwindow_direct_prop->win_unfocus_callback_ctx_list) , struct WindowCallbackContext , win_callback_ctx_list_node )
	{
		list_del( & (win_callback_ctx->win_callback_ctx_list_node) );

		free( win_callback_ctx );
	}

	list_for_each_entry_safe( win_callback_ctx , next_win_callback_ctx , & (guiwindow_direct_prop->win_key_callback_ctx_list) , struct WindowCallbackContext , win_callback_ctx_list_node )
	{
		list_del( & (win_callback_ctx->win_callback_ctx_list_node) );

		free( win_callback_ctx );
	}

	list_for_each_entry_safe( win_callback_ctx , next_win_callback_ctx , & (guiwindow_direct_prop->win_mouse_button_callback_ctx_list) , struct WindowCallbackContext , win_callback_ctx_list_node )
	{
		list_del( & (win_callback_ctx->win_callback_ctx_list_node) );

		free( win_callback_ctx );
	}

	list_for_each_entry_safe( win_callback_ctx , next_win_callback_ctx , & (guiwindow_direct_prop->win_state_callback_ctx_list) , struct WindowCallbackContext , win_callback_ctx_list_node )
	{
		list_del( & (win_callback_ctx->win_callback_ctx_list_node) );

		free( win_callback_ctx );
	}

	list_for_each_entry_safe( win_callback_ctx , next_win_callback_ctx , & (guiwindow_direct_prop->win_timer_callback_ctx_list) , struct WindowCallbackContext , win_callback_ctx_list_node )
	{
		list_del( & (win_callback_ctx->win_callback_ctx_list_node) );

		free( win_callback_ctx );
	}

	if( guiwindow_direct_prop->win_close_callback_ctx )
	{
		free( guiwindow_direct_prop->win_close_callback_ctx );
	}

	list_for_each_entry_safe( ctl_callback_ctx , next_ctl_callback_ctx , & (guiwindow_direct_prop->ctl_gene_callback_ctx_list) , struct ControlCallbackContext , ctl_callback_ctx_list_node )
	{
		list_del( & (ctl_callback_ctx->ctl_callback_ctx_list_node) );
		
		if( ctl_callback_ctx->guiwindow_obj )
			DestroyObject( rt , ctl_callback_ctx->guiwindow_obj );
		if( ctl_callback_ctx->guictl_obj )
			DestroyObject( rt , ctl_callback_ctx->guictl_obj );
		
		free( ctl_callback_ctx );
	}
	
	list_for_each_entry_safe( ctl_callback_ctx , next_ctl_callback_ctx , & (guiwindow_direct_prop->ctl_focus_callback_ctx_list) , struct ControlCallbackContext , ctl_callback_ctx_list_node )
	{
		list_del( & (ctl_callback_ctx->ctl_callback_ctx_list_node) );
		
		if( ctl_callback_ctx->guiwindow_obj )
			DestroyObject( rt , ctl_callback_ctx->guiwindow_obj );
		if( ctl_callback_ctx->guictl_obj )
			DestroyObject( rt , ctl_callback_ctx->guictl_obj );
		
		free( ctl_callback_ctx );
	}
	
	list_for_each_entry_safe( ctl_callback_ctx , next_ctl_callback_ctx , & (guiwindow_direct_prop->ctl_unfocus_callback_ctx_list) , struct ControlCallbackContext , ctl_callback_ctx_list_node )
	{
		list_del( & (ctl_callback_ctx->ctl_callback_ctx_list_node) );
		
		if( ctl_callback_ctx->guiwindow_obj )
			DestroyObject( rt , ctl_callback_ctx->guiwindow_obj );
		if( ctl_callback_ctx->guictl_obj )
			DestroyObject( rt , ctl_callback_ctx->guictl_obj );
		
		free( ctl_callback_ctx );
	}
	
	list_for_each_entry_safe( ctl_callback_ctx , next_ctl_callback_ctx , & (guiwindow_direct_prop->ctl_key_callback_ctx_list) , struct ControlCallbackContext , ctl_callback_ctx_list_node )
	{
		list_del( & (ctl_callback_ctx->ctl_callback_ctx_list_node) );
		
		if( ctl_callback_ctx->guiwindow_obj )
			DestroyObject( rt , ctl_callback_ctx->guiwindow_obj );
		if( ctl_callback_ctx->guictl_obj )
			DestroyObject( rt , ctl_callback_ctx->guictl_obj );
		
		free( ctl_callback_ctx );
	}
	
	list_for_each_entry_safe( ctl_callback_ctx , next_ctl_callback_ctx , & (guiwindow_direct_prop->ctl_mouse_button_callback_ctx_list) , struct ControlCallbackContext , ctl_callback_ctx_list_node )
	{
		list_del( & (ctl_callback_ctx->ctl_callback_ctx_list_node) );
		
		if( ctl_callback_ctx->guiwindow_obj )
			DestroyObject( rt , ctl_callback_ctx->guiwindow_obj );
		if( ctl_callback_ctx->guictl_obj )
			DestroyObject( rt , ctl_callback_ctx->guictl_obj );
		
		free( ctl_callback_ctx );
	}
	
	list_for_each_entry_safe( ctl_callback_ctx , next_ctl_callback_ctx , & (guiwindow_direct_prop->ctl_listbox_row_callback_ctx_list) , struct ControlCallbackContext , ctl_callback_ctx_list_node )
	{
		list_del( & (ctl_callback_ctx->ctl_callback_ctx_list_node) );
		
		if( ctl_callback_ctx->guiwindow_obj )
			DestroyObject( rt , ctl_callback_ctx->guiwindow_obj );
		if( ctl_callback_ctx->guictl_obj )
			DestroyObject( rt , ctl_callback_ctx->guictl_obj );
		
		free( ctl_callback_ctx );
	}
	
	list_for_each_entry_safe( ctl_callback_ctx , next_ctl_callback_ctx , & (guiwindow_direct_prop->ctl_flowbox_child_activated_callback_ctx_list) , struct ControlCallbackContext , ctl_callback_ctx_list_node )
	{
		list_del( & (ctl_callback_ctx->ctl_callback_ctx_list_node) );
		
		if( ctl_callback_ctx->guiwindow_obj )
			DestroyObject( rt , ctl_callback_ctx->guiwindow_obj );
		if( ctl_callback_ctx->guictl_obj )
			DestroyObject( rt , ctl_callback_ctx->guictl_obj );
		
		free( ctl_callback_ctx );
	}
	
	list_for_each_entry_safe( ctl_callback_ctx , next_ctl_callback_ctx , & (guiwindow_direct_prop->ctl_notify_callback_ctx_list) , struct ControlCallbackContext , ctl_callback_ctx_list_node )
	{
		list_del( & (ctl_callback_ctx->ctl_callback_ctx_list_node) );
		
		if( ctl_callback_ctx->guiwindow_obj )
			DestroyObject( rt , ctl_callback_ctx->guiwindow_obj );
		if( ctl_callback_ctx->guictl_obj )
			DestroyObject( rt , ctl_callback_ctx->guictl_obj );
		
		free( ctl_callback_ctx );
	}
	
	list_for_each_entry_safe( ctl_callback_ctx , next_ctl_callback_ctx , & (guiwindow_direct_prop->ctl_menu_item_callback_ctx_list) , struct ControlCallbackContext , ctl_callback_ctx_list_node )
	{
		list_del( & (ctl_callback_ctx->ctl_callback_ctx_list_node) );
		
		if( ctl_callback_ctx->guiwindow_obj )
			DestroyObject( rt , ctl_callback_ctx->guiwindow_obj );
		if( ctl_callback_ctx->guictl_obj )
			DestroyObject( rt , ctl_callback_ctx->guictl_obj );
		
		free( ctl_callback_ctx );
	}

	list_for_each_entry_safe( win_callback_obj , next_win_callback_obj , & (guiwindow_direct_prop->win_callback_ctl_list) , struct WindowCallbackControl , win_callback_ctl_list_node )
	{
		list_del( & (win_callback_obj->win_callback_ctl_list_node) );

		DestroyObject( rt , win_callback_obj->guictl_obj );

		free( win_callback_obj );
	}
	
	list_for_each_entry_safe( win_ctl_grp , next_win_ctl_grp , & (guiwindow_direct_prop->win_ctl_grp_list) , struct WindowControlGroup , win_ctl_grp_list_node )
	{
		list_del( & (win_ctl_grp->win_ctl_grp_list_node) );

		free( win_ctl_grp->group_name );

		free( win_ctl_grp );
	}

	g_object_unref( guiwindow_direct_prop->action_group );

	ZLFREE( guiwindow_direct_prop );
	
	return;
}

ZlangSummarizeDirectPropertySizeFunction ZlangSummarizeDirectPropertySize_guiwindow;
void ZlangSummarizeDirectPropertySize_guiwindow( struct ZlangRuntime *rt , struct ZlangObject *obj , size_t *summarized_obj_size , size_t *summarized_direct_prop_size )
{
	SUMMARIZE_SIZE( summarized_direct_prop_size , sizeof(struct ZlangDirectProperty_guiwindow) )
	return;
}

static struct ZlangDirectFunctions direct_funcs_guiwindow =
	{
		ZLANG_OBJECT_guiwindow , /* char *ancestor_name */
		
		ZlangCreateDirectProperty_guiwindow , /* ZlangCreateDirectPropertyFunction *create_entity_func */
		ZlangDestroyDirectProperty_guiwindow , /* ZlangDestroyDirectPropertyFunction *destroy_entity_func */
		
		NULL , /* ZlangFromCharPtrFunction *from_char_ptr_func */
		NULL , /* ZlangToStringFunction *to_string_func */
		NULL , /* ZlangFromDataPtrFunction *from_data_ptr_func */
		NULL , /* ZlangGetDataPtrFunction *get_data_ptr_func */
		
		NULL , /* ZlangOperatorFunction *oper_PLUS_func */
		NULL , /* ZlangOperatorFunction *oper_MINUS_func */
		NULL , /* ZlangOperatorFunction *oper_MUL_func */
		NULL , /* ZlangOperatorFunction *oper_DIV_func */
		NULL , /* ZlangOperatorFunction *oper_MOD_func */
		
		NULL , /* ZlangUnaryOperatorFunction *unaryoper_NEGATIVE_func */
		NULL , /* ZlangUnaryOperatorFunction *unaryoper_NOT_func */
		NULL , /* ZlangUnaryOperatorFunction *unaryoper_BIT_REVERSE_func */
		NULL , /* ZlangUnaryOperatorFunction *unaryoper_PLUS_PLUS_func */
		NULL , /* ZlangUnaryOperatorFunction *unaryoper_MINUS_MINUS_func */
		
		NULL , /* ZlangCompareFunction *comp_EGUAL_func */
		NULL , /* ZlangCompareFunction *comp_NOTEGUAL_func */
		NULL , /* ZlangCompareFunction *comp_LT_func */
		NULL , /* ZlangCompareFunction *comp_LE_func */
		NULL , /* ZlangCompareFunction *comp_GT_func */
		NULL , /* ZlangCompareFunction *comp_GE_func */
		
		NULL , /* ZlangLogicFunction *logic_AND_func */
		NULL , /* ZlangLogicFunction *logic_OR_func */
		
		NULL , /* ZlangLogicFunction *bit_AND_func */
		NULL , /* ZlangLogicFunction *bit_XOR_func */
		NULL , /* ZlangLogicFunction *bit_OR_func */
		NULL , /* ZlangLogicFunction *bit_MOVELEFT_func */
		NULL , /* ZlangLogicFunction *bit_MOVERIGHT_func */
		
		ZlangSummarizeDirectPropertySize_guiwindow , /* ZlangSummarizeDirectPropertySizeFunction *summarize_direct_prop_size_func */
	} ;

ZlangImportObjectFunction ZlangImportObject_guiwindow;
struct ZlangObject *ZlangImportObject_guiwindow( struct ZlangRuntime *rt )
{
	struct ZlangObject	*obj = NULL ;
	struct ZlangObject	*prop = NULL ;
	struct ZlangFunction	*func = NULL ;
	int			nret = 0 ;
	
	nret = ImportObject( rt , & obj , ZLANG_OBJECT_guiwindow , & direct_funcs_guiwindow , sizeof(struct ZlangDirectFunctions) , NULL ) ;
	if( nret )
	{
		SET_RUNTIME_ERROR( rt , RUNTIME_ERROR , ZLANG_ERROR_LINK_FUNC_TO_ENTITY , "import object to global objects heap" )
		return NULL;
	}
	
	prop = AddPropertyInObject( rt , obj , QueryObjectByObjectName(rt,"int",NULL) , "SINGLE_DOCUMENT_WINDOW_TYPE" ) ;
	if( prop == NULL )
		return NULL;
	CallRuntimeFunction_int_SetIntValue( rt , prop , GUIWINDOWTYPE_SINGLE_DOCUMENT );
	SetConstantObject( prop );
	
	prop = AddPropertyInObject( rt , obj , QueryObjectByObjectName(rt,"int",NULL) , "MULTIPLE_DOCUMENT_WINDOW_TYPE" ) ;
	if( prop == NULL )
		return NULL;
	CallRuntimeFunction_int_SetIntValue( rt , prop , GUIWINDOWTYPE_MULTIPLE_DOCUMENT );
	SetConstantObject( prop );
	
	prop = AddPropertyInObject( rt , obj , QueryObjectByObjectName(rt,"int",NULL) , "DIALOG_WINDOW_TYPE" ) ;
	if( prop == NULL )
		return NULL;
	CallRuntimeFunction_int_SetIntValue( rt , prop , GUIWINDOWTYPE_DIALOG );
	SetConstantObject( prop );
	
	prop = AddPropertyInObject( rt , obj , QueryObjectByObjectName(rt,"bool",NULL) , "PREVENT_CLOSING_WINDOW" ) ;
	if( prop == NULL )
		return NULL;
	CallRuntimeFunction_bool_SetBoolValue( rt , prop , TRUE );
	SetConstantObject( prop );
	
	prop = AddPropertyInObject( rt , obj , QueryObjectByObjectName(rt,"bool",NULL) , "ALLOW_CLOSING_WINDOW" ) ;
	if( prop == NULL )
		return NULL;
	CallRuntimeFunction_bool_SetBoolValue( rt , prop , FALSE );
	SetConstantObject( prop );
	
	prop = AddPropertyInObject( rt , obj , QueryObjectByObjectName(rt,"bool",NULL) , "CONTINUE_TIMER" ) ;
	if( prop == NULL )
		return NULL;
	CallRuntimeFunction_bool_SetBoolValue( rt , prop , G_SOURCE_CONTINUE );
	SetConstantObject( prop );
	
	prop = AddPropertyInObject( rt , obj , QueryObjectByObjectName(rt,"bool",NULL) , "REMOVE_TIMER" ) ;
	if( prop == NULL )
		return NULL;
	CallRuntimeFunction_bool_SetBoolValue( rt , prop , G_SOURCE_REMOVE );
	SetConstantObject( prop );
	
	func = AddFunctionAndParametersInObject( rt , obj , ZlangInvokeFunction_guiwindow_SetTitle_string , ZLANG_OBJECT_guiwindow , "SetTitle" , ZLANG_OBJECT_string,NULL , NULL ) ;
	if( func == NULL )
		return NULL;
	
	func = AddFunctionAndParametersInObject( rt , obj , ZlangInvokeFunction_guiwindow_GetTitle , ZLANG_OBJECT_string , "GetTitle" , NULL ) ;
	if( func == NULL )
		return NULL;
	
	func = AddFunctionAndParametersInObject( rt , obj , ZlangInvokeFunction_guiwindow_SetDefaultSize_int_int , ZLANG_OBJECT_guiwindow , "SetDefaultSize" , ZLANG_OBJECT_int,NULL , ZLANG_OBJECT_int,NULL , NULL ) ;
	if( func == NULL )
		return NULL;

#if 0
	func = AddFunctionAndParametersInObject( rt , obj , ZlangInvokeFunction_guiwindow_Resize_int_int , ZLANG_OBJECT_guiwindow , "Resize" , ZLANG_OBJECT_int,NULL , ZLANG_OBJECT_int,NULL , NULL ) ;
	if( func == NULL )
		return NULL;
#endif

#if 0
	func = AddFunctionAndParametersInObject( rt , obj , ZlangInvokeFunction_guiwindow_SetPosition_int , ZLANG_OBJECT_guiwindow , "SetPosition" , ZLANG_OBJECT_int,NULL , NULL ) ;
	if( func == NULL )
		return NULL;
#endif

#if 0
	func = AddFunctionAndParametersInObject( rt , obj , ZlangInvokeFunction_guiwindow_SetFullscreen_bool , ZLANG_OBJECT_guiwindow , "SetFullscreen" , ZLANG_OBJECT_bool,NULL , NULL ) ;
	if( func == NULL )
		return NULL;
#endif

	func = AddFunctionAndParametersInObject( rt , obj , ZlangInvokeFunction_guiwindow_Maximize , ZLANG_OBJECT_guiwindow , "Maximize" , NULL ) ;
	if( func == NULL )
		return NULL;

	func = AddFunctionAndParametersInObject( rt , obj , ZlangInvokeFunction_guiwindow_Unmaximize , ZLANG_OBJECT_guiwindow , "Unmaximize" , NULL ) ;
	if( func == NULL )
		return NULL;

	func = AddFunctionAndParametersInObject( rt , obj , ZlangInvokeFunction_guiwindow_Minimize , ZLANG_OBJECT_guiwindow , "Minimize" , NULL ) ;
	if( func == NULL )
		return NULL;

	func = AddFunctionAndParametersInObject( rt , obj , ZlangInvokeFunction_guiwindow_Unminimize , ZLANG_OBJECT_guiwindow , "Unminimize" , NULL ) ;
	if( func == NULL )
		return NULL;

	func = AddFunctionAndParametersInObject( rt , obj , ZlangInvokeFunction_guiwindow_Fullscreen , ZLANG_OBJECT_guiwindow , "Fullscreen" , NULL ) ;
	if( func == NULL )
		return NULL;

	func = AddFunctionAndParametersInObject( rt , obj , ZlangInvokeFunction_guiwindow_Unfullscreen , ZLANG_OBJECT_guiwindow , "Unfullscreen" , NULL ) ;
	if( func == NULL )
		return NULL;

	func = AddFunctionAndParametersInObject( rt , obj , ZlangInvokeFunction_guiwindow_SetResizable_bool , ZLANG_OBJECT_guiwindow , "SetResizable" , ZLANG_OBJECT_bool,NULL , NULL ) ;
	if( func == NULL )
		return NULL;

	func = AddFunctionAndParametersInObject( rt , obj , ZlangInvokeFunction_guiwindow_SetDeletable_bool , ZLANG_OBJECT_guiwindow , "SetDeletable" , ZLANG_OBJECT_bool,NULL , NULL ) ;
	if( func == NULL )
		return NULL;

	func = AddFunctionAndParametersInObject( rt , obj , ZlangInvokeFunction_guiwindow_ShowTitlebarButtons_bool , ZLANG_OBJECT_guiwindow , "ShowTitlebarButtons" , ZLANG_OBJECT_bool,NULL , NULL ) ;
	if( func == NULL )
		return NULL;

	func = AddFunctionAndParametersInObject( rt , obj , ZlangInvokeFunction_guiwindow_SetTransientFor_guiwindow , ZLANG_OBJECT_guiwindow , "SetTransientFor" , ZLANG_OBJECT_guiwindow,NULL , NULL ) ;
	if( func == NULL )
		return NULL;

	func = AddFunctionAndParametersInObject( rt , obj , ZlangInvokeFunction_guiwindow_SetModal_bool , ZLANG_OBJECT_guiwindow , "SetModal" , ZLANG_OBJECT_bool,NULL , NULL ) ;
	if( func == NULL )
		return NULL;

	func = AddFunctionAndParametersInObject( rt , obj , ZlangInvokeFunction_guiwindow_SetControlDefaultMargin_int , ZLANG_OBJECT_guiwindow , "SetControlDefaultMargin" , ZLANG_OBJECT_int,NULL , NULL ) ;
	if( func == NULL )
		return NULL;

	func = AddFunctionAndParametersInObject( rt , obj , ZlangInvokeFunction_guiwindow_SetInteractiveDebugging_bool , ZLANG_OBJECT_guiwindow , "SetInteractiveDebugging" , ZLANG_OBJECT_bool,NULL , NULL ) ;
	if( func == NULL )
		return NULL;

	func = AddFunctionAndParametersInObject( rt , obj , ZlangInvokeFunction_guiwindow_SetChild_object , ZLANG_OBJECT_bool , "SetChild" , ZLANG_OBJECT_object,NULL , NULL ) ;
	if( func == NULL )
		return NULL;

	func = AddFunctionAndParametersInObject( rt , obj , ZlangInvokeFunction_guiwindow_SetWindowType_int , ZLANG_OBJECT_guiwindow , "SetWindowType" , ZLANG_OBJECT_int,NULL , NULL ) ;
	if( func == NULL )
		return NULL;
	
	func = AddFunctionAndParametersInObject( rt , obj , ZlangInvokeFunction_guiwindow_GetMenubar , ZLANG_OBJECT_guimenubar , "GetMenubar" , NULL ) ;
	if( func == NULL )
		return NULL;
	
	func = AddFunctionAndParametersInObject( rt , obj , ZlangInvokeFunction_guiwindow_GetToolbar , ZLANG_OBJECT_guitoolbar , "GetToolbar" , NULL ) ;
	if( func == NULL )
		return NULL;
	
	func = AddFunctionAndParametersInObject( rt , obj , ZlangInvokeFunction_guiwindow_GetContent , ZLANG_OBJECT_guiboxlayout , "GetContent" , NULL ) ;
	if( func == NULL )
		return NULL;
	
	func = AddFunctionAndParametersInObject( rt , obj , ZlangInvokeFunction_guiwindow_GetNotebook , ZLANG_OBJECT_guinotebooklayout , "GetNotebook" , NULL ) ;
	if( func == NULL )
		return NULL;
	
	func = AddFunctionAndParametersInObject( rt , obj , ZlangInvokeFunction_guiwindow_GetStatusbar , ZLANG_OBJECT_guiboxlayout , "GetStatusbar" , NULL ) ;
	if( func == NULL )
		return NULL;
	
	func = AddFunctionAndParametersInObject( rt , obj , ZlangInvokeFunction_guiwindow_RemoveToolbar , ZLANG_OBJECT_void , "RemoveToolbar" , NULL ) ;
	if( func == NULL )
		return NULL;
	
	func = AddFunctionAndParametersInObject( rt , obj , ZlangInvokeFunction_guiwindow_SetWindowMarginWidth_int , ZLANG_OBJECT_void , "SetWindowMarginWidth" , ZLANG_OBJECT_int,NULL , NULL ) ;
	if( func == NULL )
		return NULL;
	
	ADD_FUNCTION_AND_PARAMETERS_IN_OBJECT_guiwidget_all_common_functions( window )

	ADD_FUNCTION_AND_PARAMETERS_IN_OBJECT_guilayout_all_common_functions( window )
	
	func = AddFunctionAndParametersInObject( rt , obj , ZlangInvokeFunction_guiwindow_IsActive , ZLANG_OBJECT_bool , "IsActive" , NULL ) ;
	if( func == NULL )
		return NULL;
	
	func = AddFunctionAndParametersInObject( rt , obj , ZlangInvokeFunction_guiwindow_IsFullscreen , ZLANG_OBJECT_bool , "IsFullscreen" , NULL ) ;
	if( func == NULL )
		return NULL;
	
	func = AddFunctionAndParametersInObject( rt , obj , ZlangInvokeFunction_guiwindow_IsMaximized , ZLANG_OBJECT_bool , "IsMaximized" , NULL ) ;
	if( func == NULL )
		return NULL;
	
	func = AddFunctionAndParametersInObject( rt , obj , ZlangInvokeFunction_guiwindow_SetWindowActiveEventCallback_functionptr , ZLANG_OBJECT_void , "SetWindowActiveEventCallback" , ZLANG_OBJECT_functionptr,NULL , NULL ) ;
	if( func == NULL )
		return NULL;
	
	func = AddFunctionAndParametersInObject( rt , obj , ZlangInvokeFunction_guiwindow_SetWindowMaximizedEventCallback_functionptr , ZLANG_OBJECT_void , "SetWindowMaximizedEventCallback" , ZLANG_OBJECT_functionptr,NULL , NULL ) ;
	if( func == NULL )
		return NULL;
	
	func = AddFunctionAndParametersInObject( rt , obj , ZlangInvokeFunction_guiwindow_SetWindowMinimizedEventCallback_functionptr , ZLANG_OBJECT_void , "SetWindowMinimizedEventCallback" , ZLANG_OBJECT_functionptr,NULL , NULL ) ;
	if( func == NULL )
		return NULL;
	
	func = AddFunctionAndParametersInObject( rt , obj , ZlangInvokeFunction_guiwindow_SetWindowFullscreenedEventCallback_functionptr , ZLANG_OBJECT_void , "SetWindowFullscreenedEventCallback" , ZLANG_OBJECT_functionptr,NULL , NULL ) ;
	if( func == NULL )
		return NULL;
	
	func = AddFunctionAndParametersInObject( rt , obj , ZlangInvokeFunction_guiwindow_SetCloseWindowEventCallback_functionptr , ZLANG_OBJECT_void , "SetCloseWindowEventCallback" , ZLANG_OBJECT_functionptr,NULL , NULL ) ;
	if( func == NULL )
		return NULL;
	
	func = AddFunctionAndParametersInObject( rt , obj , ZlangInvokeFunction_guiwindow_SetKeyPressEventCallback_functionptr , ZLANG_OBJECT_void , "SetKeyPressEventCallback" , ZLANG_OBJECT_functionptr,NULL , NULL ) ;
	if( func == NULL )
		return NULL;
	
	func = AddFunctionAndParametersInObject( rt , obj , ZlangInvokeFunction_guiwindow_SetKeyReleaseEventCallback_functionptr , ZLANG_OBJECT_void , "SetKeyReleaseEventCallback" , ZLANG_OBJECT_functionptr,NULL , NULL ) ;
	if( func == NULL )
		return NULL;
	
	func = AddFunctionAndParametersInObject( rt , obj , ZlangInvokeFunction_guiwindow_SetMouseButtonPressEventCallback_functionptr , ZLANG_OBJECT_void , "SetMouseButtonPressEventCallback" , ZLANG_OBJECT_functionptr,NULL , NULL ) ;
	if( func == NULL )
		return NULL;
	
	func = AddFunctionAndParametersInObject( rt , obj , ZlangInvokeFunction_guiwindow_SetMouseButtonReleaseEventCallback_functionptr , ZLANG_OBJECT_void , "SetMouseButtonReleaseEventCallback" , ZLANG_OBJECT_functionptr,NULL , NULL ) ;
	if( func == NULL )
		return NULL;
	
	func = AddFunctionAndParametersInObject( rt , obj , ZlangInvokeFunction_guiwindow_OpenWindow , ZLANG_OBJECT_void , "OpenWindow" , NULL ) ;
	if( func == NULL )
		return NULL;
	
	func = AddFunctionAndParametersInObject( rt , obj , ZlangInvokeFunction_guiwindow_ShowWindow , ZLANG_OBJECT_void , "ShowWindow" , NULL ) ;
	if( func == NULL )
		return NULL;
	
	func = AddFunctionAndParametersInObject( rt , obj , ZlangInvokeFunction_guiwindow_RunMainLoop , ZLANG_OBJECT_void , "RunMainLoop" , NULL ) ;
	if( func == NULL )
		return NULL;
	
	func = AddFunctionAndParametersInObject( rt , obj , ZlangInvokeFunction_guiwindow_HideWindow , ZLANG_OBJECT_void , "HideWindow" , NULL ) ;
	if( func == NULL )
		return NULL;
	
	func = AddFunctionAndParametersInObject( rt , obj , ZlangInvokeFunction_guiwindow_CloseWindow , ZLANG_OBJECT_void , "CloseWindow" , NULL ) ;
	if( func == NULL )
		return NULL;
	
	func = AddFunctionAndParametersInObject( rt , obj , ZlangInvokeFunction_guiwindow_AddTimerEventCallback_string_int_functionptr , ZLANG_OBJECT_void , "SetTimerEventCallback" , ZLANG_OBJECT_string,NULL , ZLANG_OBJECT_int,NULL , ZLANG_OBJECT_functionptr,NULL , NULL ) ;
	if( func == NULL )
		return NULL;
	
	func = AddFunctionAndParametersInObject( rt , obj , ZlangInvokeFunction_guiwindow_GetControlByName_string , ZLANG_OBJECT_object , "GetControlByName" , ZLANG_OBJECT_string,NULL , NULL ) ;
	if( func == NULL )
		return NULL;

	func = AddFunctionAndParametersInObject( rt , obj , ZlangInvokeFunction_guiwindow_GetControlGroupSelectedRow_string , ZLANG_OBJECT_int , "GetControlGroupByName" , ZLANG_OBJECT_string,NULL , NULL ) ;
	if( func == NULL )
		return NULL;

	func = AddFunctionAndParametersInObject( rt , obj , ZlangInvokeFunction_guiwindow_GetControlGroupSelectedName_string , ZLANG_OBJECT_string , "GetControlGroupSelectedName" , ZLANG_OBJECT_string,NULL , NULL ) ;
	if( func == NULL )
		return NULL;

	func = AddFunctionAndParametersInObject( rt , obj , ZlangInvokeFunction_guiwindow_GetControlGroupSelectedString_string , ZLANG_OBJECT_string , "GetControlGroupSelectedString" , ZLANG_OBJECT_string,NULL , NULL ) ;
	if( func == NULL )
		return NULL;

	func = AddFunctionAndParametersInObject( rt , obj , ZlangInvokeFunction_guiwindow_IconNamesToArray , ZLANG_OBJECT_array , "IconNamesToArray" , NULL ) ;
	if( func == NULL )
		return NULL;

	func = AddFunctionAndParametersInObject( rt , obj , ZlangInvokeFunction_guiwindow_Debug , ZLANG_OBJECT_void , "Debug" , NULL ) ;
	if( func == NULL )
		return NULL;

	return obj ;
}

